Skip to content

Instantly share code, notes, and snippets.

View paincompiler's full-sized avatar
😈
If it compiles, it's good.

paincompiler paincompiler

😈
If it compiles, it's good.
View GitHub Profile
@paincompiler
paincompiler / README-Template.md
Last active August 29, 2017 06:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Summary

Describe what dose this project mainly do

Structure

@paincompiler
paincompiler / _reader-macros.md
Created May 29, 2016 20:39 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@paincompiler
paincompiler / python_string_built_in_hash.go
Last active February 26, 2016 09:30
simulate python 2.7 built-in __hash__ of string object
import "math/big"
// simulate python 2.7 built-in __hash__ of string object
func hash(s string) *big.Int {
if len(s) == 0 {
return big.NewInt(0)
}
value := big.NewInt(int64([]byte(s)[0]) << 7)
for _, v := range []byte(s) {
value = value.Xor(value.Mul(value, big.NewInt(1000003)), big.NewInt(int64(v)))
@paincompiler
paincompiler / nginx.conf
Last active August 29, 2015 14:26 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@paincompiler
paincompiler / client-server-model-guide.md
Last active August 29, 2015 14:24
client-server model based dev guide
@paincompiler
paincompiler / osx-mic-input-control.sh
Last active October 16, 2017 16:33
control OS X microphone input volume
osascript -e "set volume input volume 100"
# Check every minute for mic input < 100%; if it is, dial it up elegantly
* * * * * while (( `osascript -e "input volume of (get volume settings)"` < 100 )); do osascript -e "set volume input volume (input volume of (get volume settings) + 3)"; sleep 0.1; done;