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
import os | |
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
from cryptography.hazmat.primitives import padding | |
from cryptography.hazmat.backends import default_backend | |
backend = default_backend() | |
key = os.urandom(16) | |
text = b'Hello, there!' | |
padder = padding.PKCS7(algorithms.TripleDES.block_size).padder() |
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 redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
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
for f in $(find $1 -iname "*.wsp"); do | |
if [ -a $f ]; | |
then /opt/graphite/bin/whisper-set-aggregation-method.py $f max; | |
fi; | |
done |
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
## Configure eth0 | |
# | |
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
DEVICE="eth0" | |
NM_CONTROLLED="yes" | |
ONBOOT=yes | |
HWADDR=A4:BA:DB:37:F1:04 | |
TYPE=Ethernet | |
BOOTPROTO=static |
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 | |
unset RUBYOPT | |
exec \ | |
setuidgid kenchan \ | |
/home/kenchan/.rbenv/shims/agig -p 6699 -h sakura.shu-cream.net |
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
Show hidden characters
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for [JSHint][1], using [JSHint example][2] | |
// and [Ory Band's example][3] as basis and setting config values to | |
// be most strict: | |
// | |
// * set all enforcing options to true |
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
from gzip import GzipFile | |
from wsgiref.headers import Headers | |
import re | |
import cStringIO as StringIO | |
# Precompile the regex to check for gzip headers | |
re_accepts_gzip = re.compile(r'\bgzip\b') | |
# Precompile the regex to split a comma delimitered string of Vary headers |
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
;;;;;; iteration in common lisp | |
;;;; do | |
;; `do` is like `if` in c | |
(do ((x 1 (+ x 1)) | |
(y 1 (* y 2))) | |
((> x 5) y) ;; when x is bigger than 5, return y | |
(print y) |
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
def frange2(start, end=None, inc=1.0): | |
"A faster range-like function that does accept float increments..." | |
if end == None: | |
end = start + 0.0 | |
start = 0.0 | |
else: start += 0.0 # force it to be a float | |
count = int((end - start) / inc) | |
if start + count * inc != end: | |
# Need to adjust the count. AFAICT, it always comes up one short. |
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
/* | |
* call-seq: | |
* Rugged::Repository.new(name, options = {}) -> repository | |
* | |
* Open a Git repository with the given +name+ and return a +Repository+ object | |
* representing it. | |
* | |
*/ | |
static VALUE rb_git_repo_new(int argc, VALUE *argv, VALUE klass) | |
{ |
OlderNewer