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 | |
valid_words = ('opsub', 'opequal', 'opadd', 'opmult', 'oprdiv', 'opidiv') | |
def is_valid(str): | |
return all(word in valid_words for word in str.split()) | |
not_validated = sys.argv[1] | |
if is_valid(not_validated): |
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 <dirent.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <getopt.h> | |
#include <libgen.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <unistd.h> | |
static const char short_options [] = "d:"; |
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
def parse_test_file(filename): | |
retval = [] | |
with open(filename) as f: | |
lines = f.read().splitlines() | |
path, script = os.path.split(os.path.abspath(filename)) | |
cwd = os.getcwd() | |
if cwd != path: | |
os.chdir(path) | |
for line in lines: |
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
try: | |
// Something really long and boring | |
except (KeyboardInterrupt, SystemExit): | |
// Get me out of here | |
exit() |
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/python | |
def tryUrl(url): | |
try: | |
# check_output returns output from command so it could be printed here | |
subprocess.check_output('ping ' + url, shell=True) | |
return 1 | |
except subprocess.CalledProcessError, e: | |
print 'Connection failed, error: %s' % e.output | |
return 0 |
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 sqlite3 | |
DB_FILE = 'database.db' | |
def db_init(): | |
""" | |
Initialize the sqlite3 database if it doesn't exist or the tables are | |
missing.. | |
:return: n/a | |
""" |
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/perl | |
# Clean up Android logs so that they are easier to compare. | |
while(<>) | |
{ | |
if (m/^\[/) { | |
# Captured from UART | |
if (m/^\[.+\]\s\d\d-\d\d/) { | |
# Logcat |
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
git diff HEAD~1..HEAD | perl scripts/checkpatch.pl --no-signoff --ignore NONBLANK_AFTER_SUMMARY - |
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/python | |
import sys | |
import argparse | |
import pprint | |
def read_params(args): | |
p = argparse.ArgumentParser(epilog='TAG is required for db operations ' | |
'but can also be used without them. In that case files are named using ' | |
'it. It can also be omitted in which case results are only written to ' |