Skip to content

Instantly share code, notes, and snippets.

View sylr's full-sized avatar

Sylvain Rabot sylr

View GitHub Profile
#!/usr/bin/env bash
git svn init svn://<host>/ \
--trunk=<project>/trunk \
--branches=<project>/branches \
--tags=<project>/tags \
project.git
cd project.git
@sylr
sylr / pre-commit
Created March 29, 2010 12:46
pre-commit hook script for PHP5 projects
#!/bin/sh
#
# author : Sylvain Rabot <sylvain@abstraction.fr>
# date : 29/03/2010
#
# pre-commit hook script for PHP5 projects
#
# check PHP5 synthax of each modified files
# check tab/space indentation errors
@sylr
sylr / perl
Created March 29, 2010 16:27
perl command lines
# trim lines containing only spaces or tabs
perl -pi -e "s/^(\s+|\t+)$/\n/i" *
# remove duplicate empty lines
perl -i -0777 -pe "s/^([^\n]+)\n+$/\$1\n/mg" *
(* FROM OCAMLNET *)
(* $Id: netcgi_fcgi_10.ml 1062 2006-12-17 20:17:36Z gerd $ *)
open Unix
exception FCGI_error of string * exn
(* tuning paramaters *)
let bufsize = 100;;
(* maximum stdout/stderr record size *)
#!/usr/bin/perl
#
# author Daniel Dominik Rudnicki
# thanks to: Piotr Romanczuk
# email daniel@sardzent.org
# version 0.4.3
# webpage http://www.nginx.eu/
#
# BASED @ http://wiki.codemongers.com/NginxSimpleCGI
#
location ~ ^/php-fpm-(status|ping)$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/php-fpm-status;
include fastcgi_params;
}
#!/bin/sh
tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"
# command line can be amazing and so simple ( just a terminal! ) at the same time
# Show apps that use internet connection at the moment
lsof -P -i -n
# all parameters from latest command
!*
#edit current command line in your editor
<ctrl-x> <ctrl-e>
#!/usr/bin/env sh
if test -f ~/.evolution/.running; then
echo >&2 "evolution is running, close it before running this script"
exit 1
fi
for file in $(find ~/.evolution/ -type f -name \*.db);
do
mime=$(file $file | grep -i "SQLite")
@sylr
sylr / .bashrc
Created July 25, 2012 09:33
SSH agent tweak for screen
# SSH agent tweak for screen
export SSH_AUTH_SOCK_TMP=/tmp/$LOGNAME-ssh-agent.sock
# test link reference
if [ ! -e "$SSH_AUTH_SOCK_TMP" ]; then
# test that link exists
if [ -L "$SSH_AUTH_SOCK_TMP" ]; then
unlink $SSH_AUTH_SOCK_TMP
fi