Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import pstats
input_path = sys.argv[1]
output_path = sys.argv[2]
fp = open(output_path, "w")
s = pstats.Stats(input_path, stream=fp)
@yinyin
yinyin / active.sh
Last active August 29, 2015 13:58
Workaround the Xcode 5.1 compile option issue on building extension with system Python
# add the following to bin/active script in virtualenv sandbox
echo "ARCHFLAGS=${ARCHFLAGS}"
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
package main
import "fmt"
func main() {
fmt.Printf("Hello World.\n")
}
/*
#!/usr/bin/python
import os
for root, dirs, files in os.walk("."):
print "---"
print "root=%r" % (root,)
print "dirs=%r" % (dirs,)
print "files=%r" % (files,)
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
import logging
_log = logging.getLogger(__name__)
import uuid
/* **
Got this error on OS X 10.6 with "/": {{{
$ ./a.out /
Query on: (0x7fff5fbff980) [/]
Get realpath: (0x7fff5fbfd620) [/]
a.out(348) malloc: *** error for object 0x7fff5fbfd620: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
}}}
#include <stdio.h>
#include <getopt.h>
int main(int argc, char *argv[])
{
int enable_dog;
int enable_egg;
int enable_farm;
struct option cmd_long_options[] = {
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
printf("%d arguments.\n", argc);
for(i = 0; i < argc; i++) {
#!/usr/bin/python
""" Parsing timing information of sunrise and sunset from CWB """
import sys
import csv
import re
import pprint