Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
hello world

vizee vizee

:octocat:
hello world
View GitHub Profile
@vizee
vizee / bootstrap.rs
Created May 28, 2020
msys2 bootstrap
View bootstrap.rs
// rustc -O bootstrap.rs
fn main() {
use std::env;
let wd = env::current_dir().unwrap();
let root = env::args()
.skip(1)
.next()
.map(|s| std::path::PathBuf::from(s))
.unwrap_or(wd.clone());
@vizee
vizee / searchtag_amd64.s
Created Mar 20, 2020
search indirect tag by binary search
View searchtag_amd64.s
#include "textflag.h"
// func searchTag(m *Message, tag int) int
TEXT ·searchTag(SB), NOSPLIT, $0-24
MOVQ m+0(FP), BX
MOVQ tag+8(FP), R9
MOVQ 16(BX), DI
MOVQ 24(BX), CX
MOVQ 40(BX), SI
XORQ DX, DX
View treap.go
package treap
type node struct {
key int
prior int
left *node
right *node
}
func zig(p *node) *node {
@vizee
vizee / appime.c
Last active Oct 9, 2020
hook Apps key to switch IME
View appime.c
/*
gcc -std=c99 -O3 -Wall -Werror \
-DUNICODE \
-o $@ $^ \
-lkernel32 -luser32 \
-Wl,--subsystem,windows,--gc-sections,--strip-all
*/
#include <windows.h>
#define WM_USER_SWITCH_IME (WM_USER + 1)
@vizee
vizee / dupfile.go
Created Sep 17, 2018
find duplicated file
View dupfile.go
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
View xxtea.go
package xxtea
import (
"unsafe"
)
const _DELTA = 0x9e3779b9
func EncryptBytes(m []byte, k *[4]uint32) {
if len(m) < 8 {
View enable-bbr.sh
if [ -z `lsmod | grep bbr` ]; then
modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
fi
if [ -z `sysctl net.ipv4.tcp_congestion_control | grep bbr` ]; then
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
fi
@vizee
vizee / lgb.sh
Created Oct 13, 2017
linux go build
View lgb.sh
#!/bin/bash
set -e
hook=
if [ "$1" == "-c" ]; then
hook=$2
shift 2
fi
@vizee
vizee / emailnotifier.go
Created Oct 1, 2017
smtp tls connection
View emailnotifier.go
package emailnotifier
import (
"crypto/tls"
"fmt"
"net"
"net/smtp"
"strings"
"sync"
)
@vizee
vizee / gensyscall.go
Created Aug 12, 2017
generate linux amd64 syscall
View gensyscall.go
package main
import (
"flag"
"fmt"
"go/ast"
"go/parser"
"go/token"
"html/template"
"io/ioutil"
You can’t perform that action at this time.