Skip to content

Instantly share code, notes, and snippets.

@kaseiwang
kaseiwang / usage.sh
Last active November 28, 2023 08:52
write and clear cloudflare's clientid in wireguard
# listening port and client_id is hardcoded in wgcf_bpf_helper.c
# compile
clang -O2 -target bpf -c wgcf_bpf_helper.c -o wgcf_bpf
# attach ingress
ip link set dev eth0 xdpdrv obj wgcf_bpf sec wg-cf-xdp-ingress
# remove ingress
ip link set dev eth0 xdpdrv off
# enable tc
@riaqn
riaqn / thumbnail_extraction.py
Last active July 17, 2021 06:25
Extract thumbnails from a image of video thumbnails grid
#TODO: test each square if it's actually a screen shot
import numpy as np
#from scipy.ndimage import gaussian_filter
from scipy.signal import convolve2d
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
import cv2
import logging
log = logging.getLogger(__name__)
@lilydjwg
lilydjwg / mosh3.py
Created November 13, 2018 07:11
mosh3: a mosh helper that reuses ssh connections (ControlMaster)
#!/usr/bin/env python3
# inspired by
# https://github.com/mobile-shell/mosh/issues/24#issuecomment-201893250
import sys
import os
import subprocess
def main():
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@alram
alram / crush_data_movement_calculator.py
Last active October 26, 2020 12:57
Calculate how much data will move before applying a CRUSHmap change
#!/usr/bin/env python
import ast
import json
import os
import subprocess
import argparse
import sys
FNULL = open(os.devnull, 'w')
@xiaq
xiaq / get-completion.bash
Last active June 15, 2020 21:27
get-completion.bash
# Usage:
# Invoke this script with the current command line, one argument per word:
#
# bash get-completion.bash pacman -S x
#
# Exits with 1 if no completer has been found.
#
# To use this as the default completion in elvish, put the following in ~/.elvish/rc.elv:
# le:completer['']={ bash /path/to/get-completion.bash $@ }
#
anonymous
anonymous / kneeEstradiol2.svg
Created August 24, 2016 13:51
I would have been stronger with Progynova GNU/Linux-libre instead of the nonfree-containing Debian!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaq
xiaq / tmux.conf
Last active February 8, 2016 22:43
set -s escape-time 20
if-shell "test $TERMINAL = roxterm" "set -s set-clipboard off"
elvish='$GOPATH/bin/elvish'
if-shell "test -x $elvish" "set -g default-shell $elvish"
set -g base-index 1
set -g renumber-windows on
set -g mouse
@a-dma
a-dma / yubitouch.sh
Last active March 10, 2022 14:43
Bash script for setting or clearing touch requirements for cryptographic operations in the OpenPGP application on a YubiKey 4.
#!/bin/bash
# Bash script for setting or clearing touch requirements for
# cryptographic operations the OpenPGP application on a YubiKey 4.
#
# Author: Alessio Di Mauro <alessio@yubico.com>
GCA=$(which gpg-connect-agent)
DO=0
UIF=0
@progheal
progheal / MCIMEpatch.py
Last active October 21, 2015 16:47
Minecraft CJK-IME patchfile generator
#!/usr/bin/env python3
# encoding=UTF-8
# Minecraft CJK-IME patchfile generator (Minecraft 中文輸入更新檔產生程式) by LPH66 @ PTT (Minecraft IGN: proghealer)
#
# Version 0.6 probably final (2015/10/22)
#
# 適用範圍:Minecraft 1.6.4 ~ 1.8.8;但 snapshot/prerelease 版本不一定適用。
#
# 系統需求: python 3.x 執行環境。(關於 python 環境安裝等事項可至 python 官方網站查詢:https://www.python.org/ )