Skip to content

Instantly share code, notes, and snippets.

@tjstein
tjstein / hack.sh
Created Apr 2, 2012 — forked from stammy/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@tjstein
tjstein / pjax.rb
Created Mar 22, 2012 — forked from kazu69/pjax.rb
Pjax(pushState + Ajax) with Sinatra and BackboneJs
View pjax.rb
#encoding: UTF-8
require 'rubygems'
require 'sinatra'
require 'erb'
require 'pp'
class Sinatra::Request
def pjax?
env['HTTP_X_PJAX'] || self['_pjax']
@tjstein
tjstein / pjax.rb
Created Mar 22, 2012 — forked from kazu69/pjax.rb
Pjax(pushState + Ajax) with Sinatra and BackboneJs
View pjax.rb
#encoding: UTF-8
require 'rubygems'
require 'sinatra'
require 'erb'
require 'pp'
class Sinatra::Request
def pjax?
env['HTTP_X_PJAX'] || self['_pjax']
@tjstein
tjstein / pjax.rb
Created Mar 22, 2012 — forked from kazu69/pjax.rb
Pjax(pushState + Ajax) with Sinatra and BackboneJs
View pjax.rb
#encoding: UTF-8
require 'rubygems'
require 'sinatra'
require 'erb'
require 'pp'
class Sinatra::Request
def pjax?
env['HTTP_X_PJAX'] || self['_pjax']
@tjstein
tjstein / lsyncd.lua
Created Aug 29, 2011
lsyncd conf for multiple targets
View lsyncd.lua
settings = {
delay = 1,
maxProcesses = 3,
logfile = "/var/log/lsyncd.log",
}
targetlist = {
"10.0.1.24:/var/www/thomasjstein.com",
"10.0.1.26:/var/www/thomasjstein.com"
}
View gist:963520
#!/bin/bash
##
## are you root?
##
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
@tjstein
tjstein / setup-ubuntu-wp.sh
Created May 5, 2011
WordPress auto-setup for Ubuntu (ve)
View setup-ubuntu-wp.sh
#!/bin/bash
cd
#
# fix locales
#
echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local
dpkg-reconfigure locales
@tjstein
tjstein / nginx-vhost.conf
Created Apr 5, 2011
nginx vhost config for WordPress + PHP-FPM
View nginx-vhost.conf
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name www.example.com;
rewrite ^ http://example.com$request_uri?;
}
View strace
root@thestartupcafe:/etc/nginx/sites-available# strace -s 128 -p 23999
Process 23999 attached - interrupt to quit
epoll_wait(6, {{EPOLLIN, {u32=245678976, u64=245678976}}}, 512, 4294967295) = 1
accept4(8, {sa_family=AF_INET, sin_port=htons(56494), sin_addr=inet_addr("72.10.62.12")}, [16], SOCK_NONBLOCK) = 3
epoll_ctl(6, EPOLL_CTL_ADD, 3, {EPOLLIN|EPOLLET, {u32=245679329, u64=245679329}}) = 0
epoll_wait(6, {{EPOLLIN, {u32=245679329, u64=245679329}}}, 512, 60000) = 1
recvfrom(3, "GET / HTTP/1.1\r\nHost: thestartupcafe.com\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefo"..., 1024, 0, NULL, NULL) = 954
stat("/var/www/thestartupcafe.com/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/var/www/thestartupcafe.com/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/var/www/thestartupcafe.com/index.php", {st_mode=S_IFREG|0644, st_size=397, ...}) = 0
View vcl.vim
" Vim syntax file
" Filename: vcl.vim
" Language: Varnish configuation Language, http://www.varnish-cache.org/wiki/VCL
" Maintainer: Elan Ruusamäe <glen@delfi.ee>
" Version Info: $Revision: 1.7 $
" Last Change: $Date: 2010/04/06 08:24:28 $ UTC
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600