This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"log" | |
"os" | |
"syscall" | |
"unsafe" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
LOGPIPE=/tmp/logpipe.$$ | |
mkfifo $LOGPIPE | |
logger -t "$0.$$" -f $LOGPIPE & | |
exec 1>$LOGPIPE | |
exec 2>&1 | |
rm -f $LOGPIPE | |
echo "hello on stdout" | |
echo "hello on stderr" >&2 | |
exec sleep 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package trie | |
import ( | |
"container/vector" | |
"sort" | |
) | |
// A 'set' structure, that can hold []byte objects. | |
// For any one []byte instance, it is either in the set or not. | |
type Trie struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body common control { | |
bundlesequence => { "set_dns_configuration" } ; | |
} | |
####################################################################### | |
# Configure DNS | |
# Use Google's DNS servers, and set the defaut domain to normation.com | |
####################################################################### | |
bundle agent set_dns_configuration { | |
vars: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Usage in python: | |
* | |
* import linux | |
* efd = linux.eventfd(0, 0) | |
* ... | |
* ret = struct.unpack('Q', os.read(efd, 8)) | |
* ... | |
* linux.close(efd) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import subprocess | |
def grep(fd, magic, chunk_size=1024, alignement=0): | |
""" | |
Iteratively yield positions of the magic in a file descriptor | |
:param fd: open file descriptor (device or a file) | |
:param magic: substring to find |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.test.client import Client as BaseClient | |
from django.core.urlresolvers import reverse | |
class Client(BaseClient): | |
""" | |
I used to be reluctant testing Django views until I wrote this class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"net/url" | |
"os" | |
"regexp" | |
"sort" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"net" | |
"net/http" | |
"time" | |
"fmt" | |
"errors" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
TOKEN=${GITHUB_TOKEN:?environment variable is empty or unset} | |
[ -n "$1" ] && GITHUB_REPOSITORY=$1 | |
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:? please provide a name of a repository} | |
OWNER=$(echo $GITHUB_REPOSITORY | cut -d/ -f1) |
OlderNewer