Skip to content

Instantly share code, notes, and snippets.

View Arnie97's full-sized avatar

Arnie97

View GitHub Profile
@KevinGoodsell
KevinGoodsell / terminals.txt
Created December 17, 2010 00:32
The Trouble With Terminals
The Trouble With Terminals
Thu, 16 Dec 2010 16:43:20 -0800
Copyright 2010 Kevin Goodsell
0. License
This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a
@je-so
je-so / glxwindow.c
Created April 4, 2011 11:58
Xlib set transparency of top level window
/* Sets the transparency of the toplevel window.
* An alpha value of 1 draws the window opaque a value of 0 makes
* it totally translucent.
* If alpha is set to a value outside of [0..1] EINVAL is returned. */
static int settransparency_helper(Display * display, Window win, double alpha)
{
int err ;
if ( alpha < 0
|| alpha > 1) {
@grawity
grawity / Makefile
Created January 11, 2012 21:33
NTFS volume creation timestamp
CC = i486-mingw32-gcc
LDFLAGS = -lntoskrnl -lntdll
volumeinfo.exe: volumeinfo.c
$(CC) -o $@ $< $(LDFLAGS)
@rsvp
rsvp / freqy.sh
Created February 18, 2012 15:43
freqy.sh : sort lines by their frequency count -- a very useful idiom as Linux bash script.
#!/usr/bin/env bash
# bash 3.2.25(1) Ubuntu 7.10 Date : 2012-02-15
#
# _______________| freqy : sort and order lines by frequency of appearance.
#
# Usage: freqy [optional: file(s)]
#
# Notes: Will work in a pipe.
# Does not alter the file(s) themselves.
#
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@saitoha
saitoha / screen-bracketed-paste-mode.diff
Created June 11, 2012 12:06
bracketed paste mode patch for GNU screen
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..ecc6e69 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -193,6 +193,7 @@ register struct win *p;
p->w_insert = 0;
p->w_revvid = 0;
p->w_mouse = 0;
+ p->w_bracketed = 0;
p->w_curinv = 0;
@sos4nt
sos4nt / xterm-256color-italic.terminfo
Created July 27, 2012 12:13
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@MercuryRising
MercuryRising / parserComparison.py
Created November 12, 2012 19:29
Pyquery, lxml, BeautifulSoup comparison
from bs4 import BeautifulSoup as bs
from pyquery import PyQuery as pq
from lxml.html import fromstring
import re
import requests
import time
def Timer():
@fqrouter
fqrouter / dns_hijacking_obversation.py
Last active September 4, 2019 10:22
让DNS查询经由python代码之手
from netfilterqueue import NetfilterQueue
import subprocess
import signal
def observe_dns_hijacking(nfqueue_element):
print('packet past through me')
nfqueue_element.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(0, observe_dns_hijacking)
def clean_up(*args):
subprocess.call('iptables -D OUTPUT -p udp --dst 8.8.8.8 -j QUEUE', shell=True)