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 | |
# Where the cookies are stored | |
COOKIES='cookies.tmp' | |
# Where the pages are temporarily stored | |
PAGE='page.tmp' | |
# value matching regex constant | |
VALUE_MATCHER='^ value="([^"]*)"' |
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
@classmethod | |
def resolve(cls, request, caching_client): | |
"""If this request isn't yet cached, cache it, otherwise return | |
a file containing the cached contents""" | |
hash = cls.hash(request) | |
is_caching = False | |
active_thread = None | |
# If there is no cached file | |
if not cls.hit(hash): | |
# obtain a lock for the active caches |
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 itertools import product | |
import string | |
id_combos = product("".join((string.ascii_lowercase, string.digits[2:])), repeat=3) | |
ids = map("".join, id_combos) | |
print len(ids), "ids found." |
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> | |
char * space = "abcdefghijklmnopqrstuvwxyz23456789"; | |
int main(){ | |
unsigned int total = 0; | |
char * end = space+34; | |
char *loop1, *loop2, *loop3; | |
loop1 = space; | |
for (; loop1 < end; loop1++) { |
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
// Allocate video frame | |
pFrame=avcodec_alloc_frame(); | |
// Allocate an AVFrame structure | |
pFrameRGB=avcodec_alloc_frame(); | |
if(pFrameRGB==NULL) | |
return -1; | |
// Determine required buffer size and allocate buffer | |
numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, |
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 socket | |
import threading | |
import argparse | |
LINE_TERM = "\n" | |
parser = argparse.ArgumentParser() | |
parser.add_argument("host", help="The host name of the server.") | |
parser.add_argument("port", type=int, help="Port of the server.") | |
args = parser.parse_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
LINE_SPLITTER = "\r\n\r\n" | |
def handle_client((csock, address)): | |
buffer = "" | |
while True: | |
tmp_buffer = csock.recv(RECV_SIZE) | |
if tmp_buffer == "": break | |
buffer += tmp_buffer | |
line = buffer.split(LINE_SPLITTER, 1) | |
if len(line) < 2: continue | |
else: |
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
class Person(object): | |
def __init__(self, name, *attrs): | |
self.name = name | |
self.attrs = set() | |
self.can(*attrs) | |
def does(self, what): | |
if what in self.attrs: return True | |
return False |
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
$ newlisp test.lsp | |
Reading first line... | |
Started! | |
Reading second line... |
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
/* Simple quoted translation program. It reads characters from | |
* stdin and writes them to standard out replacing all | |
* instances of the character 'WHAT' with the character 'WITH'. | |
* If a 'WHAT' character appears between 'QSTART' and 'QEND' | |
* (the starting and ending quote characters) it is not | |
* replaced. */ | |
#include <stdio.h> | |
#include <stdbool.h> |
OlderNewer