Skip to content

Instantly share code, notes, and snippets.

@shuhaowu
shuhaowu / glvsync.c
Created Jun 24, 2020 — forked from Cloudef/glvsync.c
Force glXSwapInterval* to whatever you want
View glvsync.c
/* gcc -std=c99 -fPIC -shared -Wl,-soname,glvsync.so glvsync.c -o glvsync.so
* gcc -m32 -std=c99 -fPIC -shared -Wl,-soname,glvsync.so glvsync.c -o glvsync.so (for 32bit)
*
* Force VSYNC interval on OpenGL applications
* Alternatively can also try FPS locking a OpenGL program
* Usage: LD_PRELOAD="/path/to/glvsync.so" ./program
*/
#define _GNU_SOURCE
#include <dlfcn.h>
@shuhaowu
shuhaowu / podman-shell.nix
Created May 24, 2020 — forked from adisbladis/podman-shell.nix
Use podman within a nix-shell
View podman-shell.nix
{ pkgs ? import <nixpkgs> {} }:
let
# To use this shell.nix on NixOS your user needs to be configured as such:
# users.extraUsers.adisbladis = {
# subUidRanges = [{ startUid = 100000; count = 65536; }];
# subGidRanges = [{ startGid = 100000; count = 65536; }];
# };
View minferry.go
package main
import (
"sync"
"github.com/Shopify/ghostferry"
"github.com/Shopify/ghostferry/copydb"
"github.com/sirupsen/logrus"
)
View gist:1b8f61f58d16cd0f7a6ae8a1fb17fb9c
#!MC 1100
$!ALTERDATA
EQUATION = '{s11} = {dUdX}'
$!ALTERDATA
EQUATION = '{s12} = 0.5*({dUdY}+{dVdX})'
$!ALTERDATA
EQUATION = '{s13} = 0.5*({dUdZ}+{dWdX})'
$!ALTERDATA
EQUATION = '{s22} = {dVdY}'
$!ALTERDATA
View samsung-evo-plus-32-gb
W530:
Running flashbench
4MiB 14M/s
2MiB 18M/s
1MiB 18M/s
512KiB 18.4M/s
256KiB 17.7M/s
128KiB 17.9M/s
64KiB 17.3M/s
@shuhaowu
shuhaowu / facebook_adblock.greasemonkey.js
Last active Aug 16, 2016
Facebook Adblock for GreaseMonkey PoC
View facebook_adblock.greasemonkey.js
// To use this script:
// - For chrome, install https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en
// - For firefox, install https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
// ==UserScript==
// @name Facebook AdBlock
// @namespace facebook_adblock
// @include https://www.facebook.com/
// @version 1
// @grant none
// ==/UserScript==
View rimworld.sh
#!/bin/bash
SAVE_BASE=~/Seafile/Public/gamesaves/RimWorld
switch_save() {
version=$1
cd ~/.config/unity3d/Ludeon\ Studios
rm RimWorld
ln -s ${SAVE_BASE}${version}$2 RimWorld
}
@shuhaowu
shuhaowu / debug-dnsmasq.sh
Created May 16, 2016
Debug dnsmasq by logging its queries
View debug-dnsmasq.sh
#!/bin/bash
echo 'log-queries' > /etc/dnsmasq.conf
service network-manager restart
tail -f /var/log/syslog
@shuhaowu
shuhaowu / release.sh
Created Mar 27, 2016
For releasing packages to PPA.
View release.sh
#!/bin/bash
set -e
PROJECT=$1
PPA_ID=$2
if [ -z $PROJECT ] || [ -z $PPA_ID ]; then
>&2 echo "usage: ./release.sh directory ppa_id"
exit 1
View check_apt.py
from fabric.api import run
def check_apt():
apt_sha = "cfd9d742f7c99d55214257fdad42ead547547c5a05af9d4569a256205af28fa7"
result = run("sha256sum /var/cache/apt/archives/apt_0.9.7.9+deb7u3_amd64.deb")
if apt_sha in result:
print "Everything is okay"
else:
print "Potential attack?"