Skip to content

Instantly share code, notes, and snippets.

@bbinet
bbinet / gist:1400782
Created November 28, 2011 15:30
bash function to checkout svn:externals when using git-svn
function git-co-externals() {
(
cd $(git rev-parse --show-toplevel) && git svn show-externals | grep "^/" |
while read a b c
do
# remove first character which is a '/'
local=${a:1}
if [ -z $c ]
then
url=$b
@wolever
wolever / example.py
Created February 18, 2012 06:31
A persistent Queue implementation in Python which focuses on durability over throughput
from pqueue import PersistentQueue
q1 = PersistentQueue("/tmp/queue_storage_dir")
q1.put("1")
q1.put("2")
q1.put("3")
q1.close()
q2 = PersistentQueue("/tmp/queue_storage_dir")
while not q2.empty():
@bbinet
bbinet / pull_and_ghpimport.sh
Created May 5, 2012 12:57
pull_and_ghpimport.sh script
#!/bin/bash
directory=$1
build_cmd=$2
if [ -z "$directory" ]; then
echo "This script takes a directory path as first parameter."
exit 1
fi
if [ -z "$build_cmd" ]; then
echo "This script takes a build command as second parameter."
@bbinet
bbinet / ebenezer-ghp-update
Created May 5, 2012 13:01
ebenezer-ghp-update cgi
#!/usr/bin/env python
import cgi
import os
import sys
if os.environ["REMOTE_ADDR"] in ["207.97.227.253", "50.57.128.197",
"108.171.174.178", "89.88.161.33"]:
print "Content-type: text/plain"
print ""
@bbinet
bbinet / gaellerie-ghp-update
Created May 5, 2012 13:01
gaellerie-ghp-update cgi
#!/usr/bin/env python
import cgi
import os
import sys
if os.environ["REMOTE_ADDR"] in ["207.97.227.253", "50.57.128.197",
"108.171.174.178", "89.88.161.33"]:
print "Content-type: text/plain"
print ""
@tonio
tonio / mapping.vim
Created June 26, 2012 12:55
know vim mappings
:new
:redir @"
:verbose map
:map!
:redir END
p
@mathieue
mathieue / udp-multi-socat.sh
Created August 28, 2012 23:57
udp multiplexer with socat
socat - udp4-listen:8125,fork | tee >(socat - udp-sendto:127.0.0.1:8135) >(socat - udp-sendto:127.0.0.1:8140)
@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
#!/usr/bin/env python3
"""Backs up data-only volumes to host backup directory using rdiff-backup.
First create a Docker image containing rdiff-backup (named rdiff-backup)
Dockerfile:
FROM ubuntu:precise
RUN apt-get update && apt-install -qy rdiff-backup
``docker build -rm -t rdiff-backup .``
#! /bin/bash
# certificates are valids during 365 days
VALID=365
TMPPASS="test"
while [[ -z "$password" ]]
do
read -s -p "Enter password for the Certificate Authority (CA) key: " password
echo