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
import sys | |
import re | |
import shlex | |
import subprocess as sp | |
exe_pat = re.compile(r'(\s*)\(!>(.*)<\)\s*') | |
inc_pat = re.compile(r'(\s*)\(>(.*)<\)\s*') | |
if __name__ == "__main__": | |
for line in sys.stdin: |
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 | |
class PythonClass: | |
def __init__(self): | |
"""A dummy constructor""" | |
def mySimpleMethod(self): | |
return "Hello World!" | |
anInstance = PythonClass() |
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
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.InputStreamReader; | |
import org.python.core.PyObject; | |
import org.python.util.PythonInterpreter; | |
public class Simple { | |
public static void main(String[] args) { |
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
#include <glib.h> | |
// ... | |
{ | |
GTimer* timeit = g_timer_new(); | |
int i; | |
g_timer_start(timeit); | |
for ( i = 0 ; i < 10000 ; i++ ){ | |
my_time_critical_function(); |
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
#include <timing.h> | |
#define DEBUG 1 | |
// ... | |
{ | |
TIMEIT_INIT(timer_name); | |
int i; | |
TIMEIT_START(timer_name); | |
for ( i = 0 ; i < 10000 ; i++ ){ |
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
#ifndef _TIMING_UTIL_H | |
#define _TIMING_UTIL_H | |
#ifdef DEBUG | |
#include <sys/time.h> | |
#define TIMEIT_INIT(name) \ | |
struct timeval timeit_t1_##name, timeit_t2_##name, timeit_diff_##name; \ | |
double timeit_interval_##name \ |
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
#include <sys/time.h> | |
// ... | |
{ | |
struct timeval t1, t2, diff; | |
double interval; | |
int i; | |
gettimeofday(t1, NULL); | |
for ( i = 0 ; i < 10000 ; i++ ){ |
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 sys | |
from socket import gethostbyaddr, herror | |
def usage(): | |
print("[usage]: %s [ip]"%(sys.argv[0])) | |
print("") | |
print("performs a reverse lookup on a host ip.") |
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 sys, re, os, popen2 | |
hosts_locs = [ | |
"/etc/hosts", | |
"C:/Windows/system32/drivers/etc/hosts" | |
] | |
hosts = {} |
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
// Will work as expected | |
"foo|bar|spam|eggs".split("\\|"); | |
//will get a compilation error | |
"foo|bar|spam|eggs".split("\|"); | |
//will split on each character | |
"foo|bar|spam|eggs".split("|"); |