Skip to content

Instantly share code, notes, and snippets.

Frédéric Menou ptitfred

  • FretLink
  • Paris, France
Block or report user

Report or block ptitfred

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View adduser-backuper.sh
sudo adduser --disabled-password backuper
sudo su backuper
cd ~/.ssh
ssh-keygen -t dsa
# entrée pour ne pas saisir de passphrase
# entrée pour garder le nom par défaut, très satisfaisant
@ptitfred
ptitfred / email-on-update.sh
Created Aug 28, 2010
Hook for Git emailing content of a push
View email-on-update.sh
#!/bin/bash
refname="$1"
oldrev="$2"
newrev="$3"
PATH=~/bin:$PATH
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
View server.cpp
#include "server.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
using std::cout;
using std::cerr;
using std::cin;
using std::endl;
using std::fstream;
@ptitfred
ptitfred / Makefile
Created Jul 25, 2011
Makeflags regression (3.80-3.81)
View Makefile
all:
@echo MAKEFLAGS = $(MAKEFLAGS)
@ptitfred
ptitfred / colorize.sh
Created Aug 1, 2011
Colorise stderr from a executable ; ERROR and WARNING rows are colorized in red and orange
View colorize.sh
#!/bin/bash
error="91"
warning="35"
( $1 3>&1 1>&2- 2>&3- ) | sed \
-e "s/^\(.* ERROR - \)\(.*\)$/\1\x1b[${error}m\2\x1b[0m/" \
-e "s/^\(.* WARNING - \)\(.*\)$/\1\x1b[${warning}m\2\x1b[0m/"
@ptitfred
ptitfred / dbstorage.coffee
Created Aug 5, 2011
HTML5 DBStorage en CoffeeScript
View dbstorage.coffee
# Handlers
nope = (tx, obj) ->
displayResult = (tx, rs) ->
alert "Succeeded!"
displayError = (tx, err) ->
alert "Error: #{err.message}"
class Storage
@ptitfred
ptitfred / model.test.coffee
Created Aug 6, 2011
TDD en Coffee Script avec QUnit
View model.test.coffee
test "Bookmark toString works", ->
### given ###
bookmark = new Bookmark "lien@localhost", "lien", new Point 0, 1
### when ###
text = bookmark.toString()
### then ###
equals "Bookmark \"lien\" lien@localhost at (0,1)", text, "Bookmark.toString()"
@ptitfred
ptitfred / build-v8-shell.sh
Created Aug 7, 2011
Script de compilation du module de shell de V8
View build-v8-shell.sh
sudo apt-get install scons g++-multilib
scons sample=shell regexp=interpreted
View git-cd.sh
#!/bin/bash
from="$1"
to="$2"
for file in $(git show --numstat $from --pretty=format: | cut -f3)
do
git diff $from $to -- $file
done
@ptitfred
ptitfred / colorize.sh
Created Sep 21, 2011
fonction bash pour colorer un text
View colorize.sh
#!/bin/bash
function color {
echo -e "\x1b[${2}m$1\x1b[0m"
}
You can’t perform that action at this time.