Skip to content

Instantly share code, notes, and snippets.

@padeoe
padeoe / enhanced-nvidia-smi.md
Last active January 8, 2025 20:04
Show Username & full process command with nvidia-smi

For typical use cases, I prefer using nvitop to view detailed information. This script offers a dependency-free implementation.

The script enhances the functionality of nvidia-smi and provides the following info:

  • Username
  • full process Command
  • GPU ID
  • PID

This is useful on multi-user servers and can be used to quickly identify which user is using the GPU and running what kind of program.

@JotaRata
JotaRata / stubs.py
Last active January 8, 2025 20:04
Auto stub generator for Cython files
'''
Auto stub generator for cython files.
LIMITATIONS:
Can only parse declared cdef variables with public/readonly keywords
Cannot parse plain defined variables (ex: "my_var = 2")
Cannot parse special members imported from C/C++
Cannot parse ctypedef types
Can only parse functions prefixed with 'def' and 'cpdef
@a-h
a-h / disablecaching.go
Created August 20, 2019 08:15
Disable caching and sniffing via HTTP headers
func DisableCachingAndSniffing(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate;")
w.Header().Set("pragma", "no-cache")
w.Header().Set("X-Content-Type-Options", "nosniff")
next.ServeHTTP(w, r)
})
}
<?php
class CustomMenuBreadcrumbs {
public $menu_location = '';
public $menu = false;
public $menu_items = array();
public function __construct( $menu_location = '' ) {
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@amboutwe
amboutwe / yoast_seo_breadcrumb_add_woo_shop.php
Last active January 8, 2025 19:57
Multiple examples of how to customize the Yoast SEO breadcrumbs
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page.
* Credit: https://wordpress.stackexchange.com/users/8495/rjb
* Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3
*/
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' );
@jpluimers
jpluimers / README.md
Last active January 8, 2025 19:56 — forked from alimbada/Wake.ps1
Wake-on-LAN.ps1 PowerShell script for sending Wake-on-LAN magic packets to given machine's hardware MAC address

Wake-on-LAN.ps1: a Wake-on-LAN PowerShell script

Wake-on-LAN.ps1 PowerShell script for sending Wake-on-LAN magic packets to given machine's hardware MAC address

This script originated is a modification [Wayback] WakeUp-Machines.ps1 by Matthijs ten Seldam, Microsoft that has the drawback of requiring a text file with the machines to wake up, and (before his change) the original reliance on the above mentioned [Wayback] WolCmd.exe in the current directory.

[[Wayback]](https://web.archive.org/web/2021

Решил я совместить все бесплатные обходы для стабильного и быстрого интернета. Я не понимаю в програмировании,
не понимаю в linux, в основном копипастю. Много читал, искал и решил сам написать и собратть в одном месте.
Хорошо, что Github еще не заблокирован. Начнем!
Нужен роутер с минимум 256мб оперативки и 128мб памятью. (ax3000t и ax6000 redmi - проверял на них)
1. Устанавливаем zapret. https://gist.github.com/barmaley6699/37b10173481f69e10d824faef541352f
2. Ставим https-dns-proxy и luci-app-https-dns-proxy .
# Провайдер - Custom
Параметр - https://dns.controld.com/comss
Bootstrap DNS - 76.76.2.22
### Установка и настройка zapret на роутер c openwrt 23.05.4
### Проверялось windows11, android - работает!!!
### Устанавливаем OpenWrrt на роутер.
### И Настраиваем Все Порты (wan, lan - добавить ВСЕ!)!!! Это Главное!
### Проверить программный flow offloading (должен быть отключен!)
### Заходим на роутер через Putty или как вы умеете.
### ставим программы
// Gradual-commit arena demonstration
// This is free and unencumbered software released into the public domain.
#include <stddef.h>
#include <string.h>
static void *os_reserve(ptrdiff_t);
static _Bool os_commit(void *, ptrdiff_t);
#define ARENA_PAGESIZE ((ptrdiff_t)1<<26)