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 | |
if [ $# -ne 3 ]; then | |
echo "$0 URL loops timeout" | |
exit 1; | |
fi | |
PID=`pgrep cherokee-worker` | |
echo "Start: cherokee-worker PID: $PID" |
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 | |
# CONFIGURATION | |
URL=http://127.0.0.1:8081/index.html | |
LOOPS=10 | |
# DEFAULT | |
TIME=16 | |
if [ $# -eq 1 ]; then |
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
args = { | |
'db': connect['database'], | |
'user': connect['username'], | |
'passwd': connect['password'], | |
} | |
if 'hostname' in connect: | |
# hostname implies port (although it can be default) | |
args['host'] = connect['hostname'] | |
args['port'] = connect['port'] |
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/python | |
import sys, os | |
import signal | |
quit_requested = False | |
def intSigHandler(signal, frame): | |
quit_requested = 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
#random key | |
from random import choice | |
charset = [chr(i) for i in range(32,38) + range(40,127)] | |
secret_key = ''.join([choice(charset) for i in range(64)]) | |
print secret_key |
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 hashlib import sha1 | |
from random import random, choice | |
class Password(object): | |
"""Manage hash-salted passwords.""" | |
HASH = sha1 | |
SALT_LEN = 24 | |
HASHED_LEN = len(HASH().hexdigest()) + SALT_LEN |
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
#define DEBUG(fmt, args...) fprintf(stderr, "DEBUG[%s:%d]: "fmt, __FILE__, __LINE__, args) | |
/* disable debug logs */ | |
#undef DEBUG | |
#define DEBUG(args...) /* args */ |
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
>>> a = [(1, 'red'), (2, 'red'), (1, 'blue'), (3, 'green')] | |
>>> b = dict(a) | |
>>> b | |
{1: 'blue', 2: 'red', 3: 'green'} | |
>>> | |
# keep in mind 2d occurrence of the key will be the one remaining in the dict |
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
#include<stdio.h> | |
#define BUTTON1 1 | |
#define BUTTON2 3 | |
#define BUTTON3 6 | |
#define BUTTON4 12 | |
/* button, value */ | |
#define IS_PRESSED(x, y) (y >> 4 == x) |
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 django.test.client import Client | |
from django.test import TestCase | |
from django.conf import settings | |
from django.utils.importlib import import_module | |
from project.app.models import User | |
class MyTestCase(TestCase): | |
def setUp(self): | |
settings.SESSION_ENGINE = 'django.contrib.sessions.backends.file' |
OlderNewer