This file contains hidden or 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
| /** | |
| gcc -std=c99 -Wall -g *.c && ./a.out | |
| */ | |
| #include <assert.h> | |
| #include <iso646.h> // and, or | |
| #include <stdio.h> // putchar | |
| #include <stdlib.h> // size_t | |
| #include <string.h> // strcspn | |
| #include <stddef.h> // ptrdiff_t |
This file contains hidden or 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 | |
| """Translation of "Coroutines in C" in Python | |
| http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html | |
| """ | |
| EOF = b'' | |
| def decompressor(getchar): | |
| for c in iter(getchar, EOF): |
This file contains hidden or 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 random | |
| import sys | |
| import sqlite3 | |
| from pprint import pprint | |
| try: | |
| import numpy as np | |
| from itertools import izip |
This file contains hidden or 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 | |
| # -*- coding: utf-8 -*- | |
| import glob | |
| import os | |
| import sqlite3 | |
| # support both Python 2.x and 3.x | |
| try: buffer = buffer | |
| except NameError: | |
| buffer = lambda x: x # on Python 3.x 'rb' mode already returns what we need |
This file contains hidden or 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
| CFLAGS = -O2 -g \ | |
| -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \ | |
| -std=c99 -Wall -Wextra -pedantic \ | |
| -Wunused -Wimplicit -Wshadow -Wformat=2 \ | |
| -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \ | |
| -Wbad-function-cast -Wnested-externs -Wcomment -Winline \ | |
| -Wchar-subscripts -Wcast-align \ | |
| -Wsequence-point \ | |
| LDFLAGS = |
This file contains hidden or 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.out |
This file contains hidden or 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
| """SSL client/server certificates verification for `urllib2`. | |
| It works on Python 2.6, 2.7, 3.1, 3.2 | |
| It also works on Python 2.4, 2.5 if `ssl` is installed (``pip install ssl``) | |
| Example:: | |
| >>> import urllib2, urllib2_ssl | |
| >>> opener = urllib2.build_opener(urllib2_ssl.HTTPSHandler( | |
| ... key_file='clientkey.pem', |
This file contains hidden or 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
| int main() | |
| { | |
| int mx = [] () -> struct { int x, y ; } { return { 99, 101 } ; } ().x ; | |
| } |
This file contains hidden or 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
| // gcc -std=c99 -Wall -pedantic -Wextra *.c -lreadline && ./a.out | |
| #include <limits.h> // INT_MAX | |
| #include <stdio.h> | |
| #include <stdlib.h> // strtol | |
| #include <readline/readline.h> | |
| // space = \s+ | |
| // skip one or more ' ' characters | |
| // return a pointer to the first non-' ' character or NULL on error |
This file contains hidden or 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
| # checkout pyintaller | |
| ##svn co http://svn.pyinstaller.org/trunk pyinstaller && cd pyinstaller | |
| # make Python script that prints uid, euid | |
| printf '#!/usr/bin/env python\nimport os\nprint(os.getuid(),os.geteuid())\n' >print-uid.py | |
| # create stand-alone executable | |
| python pyinstaller.py -F print-uid.py | |
| # change ownership to root |