Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / github_post_recieve.php
Created October 11, 2010 02:04
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
@brikis98
brikis98 / BinaryModules.js
Created December 1, 2011 00:45
Node.js performance tips
// Use built in or binary modules
var crypto = require('crypto');
var hash = crypto.createHmac("sha1",key).update(signatureBase).digest("base64");
@Goles
Goles / zsh_git_timer.sh
Created March 7, 2012 04:06
ZSH Snippets to add time since last commit, got this somewhere... forgot where :)
# Add this to your .oh-my-zsh theme if you're using those, or directly to your zsh theme :)
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mattmccray
mattmccray / Makefile
Created October 19, 2012 04:15
Simple comparison of several compile-to-javascript languages, including: CoffeeScript, Dart, Haxe, and TypeScript.
.PHONY: compile
time=/usr/bin/time
compile: dart typescript coffeescript haxe jsx
dart:
$(time) dart2js -ooutput/dart.js source/simple.dart
typescript:
@gamedevsam
gamedevsam / TomlConfig
Last active December 16, 2015 03:59
TomlConfig.hx - An assistant class to HaxeToml that provides an intuitive and type-safe approach to run-time data loading using Haxe Reflection. This class supports reloading of config files at run-time on cpp targets.
package ;
import haxe.Utf8;
import nme.Assets;
// requires haxetoml: https://github.com/raincole/haxetoml
import haxetoml.TomlParser;
#if cpp
import sys.io.File;
import sys.FileSystem;
#end
@mathiasbynens
mathiasbynens / deterministic-math-random.js
Last active May 16, 2024 12:37
Here’s a 100% deterministic (predictable) alternative to `Math.random`. Useful when benchmarking.
// Here’s a 100% deterministic alternative to `Math.random`. Google’s V8 and
// Octane benchmark suites use this to ensure predictable results.
Math.random = (function() {
var seed = 0x2F6E2B1;
return function() {
// Robert Jenkins’ 32 bit integer hash function
seed = ((seed + 0x7ED55D16) + (seed << 12)) & 0xFFFFFFFF;
seed = ((seed ^ 0xC761C23C) ^ (seed >>> 19)) & 0xFFFFFFFF;
seed = ((seed + 0x165667B1) + (seed << 5)) & 0xFFFFFFFF;
@natritmeyer
natritmeyer / mount_smbfs.sh
Created September 19, 2013 09:40
How to mount and unmount a SMB share on Mac OS X (using mount_smbfs)
#Mounting the share is a 2 stage process:
# 1. Create a directory that will be the mount point
# 2. Mount the share to that directory
#Create the mount point:
mkdir share_name
#Mount the share:
mount_smbfs //username:password@server.name/share_name share_name/
@julionc
julionc / 00.howto_install_phantomjs.md
Last active May 30, 2024 16:08
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@jegtnes
jegtnes / Antiviral
Last active January 6, 2017 05:33
A list of Tweetbot mute filters for "viral" clickbaity headlines to reduce the amount of pageview-farming crap listicles you get exposed to on the internet these days. Inspired by @snipe's Downworthy: http://downworthy.snipe.net/ — if only Tweetbot supported regex replace…
Listicles:
(?i)(([0-9]{1,3})|three|four|five|six|seven|eight|nine|ten|eleven|twelve|twenty|eigh|thir|four|fif|six|seven|eight|nine)(teen|ty)?( (more|extra))? (reasons?|weird|things?|gifs?|spectacular|fantastic|tips|pieces|confessions|awesome|ludicrous|incredible|stages|movies?|films?|crazy|epic|easy|outrageous(ly)?|hilarous(ly)?|scar(y|iest)|\bof the\b|ways?|signs?|life ?(hacks?)|tweets|impossibl(e|ly)|productiv(e|ivity)|quotes|apps|best|simple)
Hyperbole:
(?i)what happen(s|ed) next
(?i)((won|can)'t|(will|can) ?not) believe
(?i)faith in humanity
(?i)can('|no)?t (even )?handle
(?i)viral
(?i)(life|work(place)?|office) hacks?