Skip to content

Instantly share code, notes, and snippets.

View Sitebase's full-sized avatar
🤘

Wim Mostmans Sitebase

🤘
View GitHub Profile
@wankdanker
wankdanker / broadcast.js
Created November 2, 2011 18:51
simple test cases for broadcast and multicast compatibility between node.js v0.4.x and v0.6.x
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
var testMessage = "[hello world] pid: " + process.pid;
var broadcastAddress = '255.255.255.255';
var broadcastPort = 5555;
socket.setBroadcast(true);
socket.bind(broadcastPort, '0.0.0.0');
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@basecode
basecode / detect_special_characters.py
Created December 22, 2011 11:15
'no-break space' detection plugin for Sublime Text 2
# encoding: utf-8
import sublime, sublime_plugin
class DetectSpecialCharacters(sublime_plugin.EventListener):
def on_load(self, view):
sublime.status_message("detect_special_characters is active")
def on_modified(self, view):
# find no-break space
special_characters = view.find_all(u"\u00A0")
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@ruturajv
ruturajv / beacon.js
Created April 25, 2012 04:28
node.js web beacon (web bug) serving
http = require('http');
url = require('url');
http.createServer(function(req, res){
var requestURL = url.parse(req.url, true)['pathname'];
if (requestURL == '/log.gif') {
var imgHex = '47494638396101000100800000dbdfef00000021f90401000000002c00000000010001000002024401003b';
var imgBinary = new Buffer(imgHex, 'hex');
res.writeHead(200, {'Content-Type': 'image/gif' });
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@iphoting
iphoting / build-php.sh
Created May 10, 2012 04:06
Precompile Heroku PHP Binaries
#!/bin/bash
# use AMI ami-04c9306d
# run this script as root.
## EDIT
export S3_BUCKET="heroku-buildpack-php-tyler"
export LIBMCRYPT_VERSION="2.5.8"
export PHP_VERSION="5.4.1"
export APC_VERSION="3.1.10"
export PHPREDIS_VERSION="2.2.1"
@pateketrueke
pateketrueke / install.sh
Last active October 7, 2015 10:47
Apache 2.2.24 & PHP 5.4.14 / Heroku pre-compile script
mkdir -p /app
# Prepare the filesystem
mkdir -p /tmp/build
cd /tmp/build
# Compiling Apache
curl http://www.us.apache.org/dist/httpd/httpd-2.2.24.tar.gz | tar xzf -
@daveygm
daveygm / cookie.js
Created July 23, 2012 16:39
JS: Read, write and erase cookies with JavaScript.
@jellea
jellea / gist:3438926
Created August 23, 2012 17:18
Webcam snapshot on every git commit
#!/bin/bash
#
# This script will make a webcam snapshot every commit. The jpg file will have
# the commit id as the filename.
#
# This script requires imagesnap. Install with: 'brew install imagesnap'
#
# Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by:
# 'chmod +x .git/hooks/post-commit'
#