Skip to content

Instantly share code, notes, and snippets.

View criccomini's full-sized avatar

Chris criccomini

View GitHub Profile
$ cat /proc/cgroups
#subsys_name hierarchy num_cgroups enabled
cpuset 0 1 1
ns 0 1 1
cpu 0 1 1
cpuacct 0 1 1
memory 0 1 1
devices 0 1 1
freezer 0 1 1
net_cls 0 1 1
$ uname -a
Linux localhost 2.6.32-220.13.1.el6.x86_64 #1 SMP Thu Mar 29 11:46:40 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
@criccomini
criccomini / gist:3805436
Created September 29, 2012 23:50
Schedules & Scores API for Streaming Live Sports Stats - MSNBC
import pytz
import datetime
import time
import urllib2
import json
import os
import elementtree.ElementTree as ET
# e.g. http://scores.nbcsports.msnbc.com/ticker/data/gamesMSNBC.js.asp?jsonp=true&sport=MLB&period=20120929
url = 'http://scores.nbcsports.msnbc.com/ticker/data/gamesMSNBC.js.asp?jsonp=true&sport=%s&period=%d'
@criccomini
criccomini / gist:3805418
Created September 29, 2012 23:32
Schedules & Scores API for Streaming Live Sports Stats - XLS
<xml>
<Match id="2de567bc9800aa97560f7eecf3295ed83dff0679" sport="baseball" name="Texas Rangers-Los Angeles Angels" date="2012-09-29 22:05" startdate="2012-09-29" starttime="22:05" status="Not started" status_upcoming="yes" status_finished="no" status_inprogress="no" round="1" time_left_current_period="">
<Competition id="MLB" stageid="MLB_2012" name="MLB" season="2012" countryid="USA" countryname="USA"/>
<Venue name="Rangers Ballpark in Arlington" spectators=""/>
<Competitors>
<Competitor type="1" id="TEXAS-RANGERS" name="Texas Rangers"/>
<Competitor type="2" id="LOS-ANGELES-ANGELS" name="Los Angeles Angels"/>
</Competitors>
<Scores>
<Score type="runningscore" name="-:-"/>
@criccomini
criccomini / gist:3786342
Created September 26, 2012 05:56
Killing Subprocesses in Linux/Bash - Recursive Trap
kill_child_processes() {
isTopmost=$1
curPid=$2
childPids=`ps -o pid --no-headers --ppid ${curPid}`
for childPid in $childPids
do
kill_child_processes 0 $childPid
done
if [ $isTopmost -eq 0 ]; then
kill -9 $curPid 2> /dev/null
@criccomini
criccomini / gist:3779273
Created September 25, 2012 00:24
Simple Login Screen - LoginViewController.m
#import "LoginViewController.h"
@implementation LoginViewController
@synthesize usernameField;
@synthesize passwordField;
@synthesize loginButton;
@synthesize loginIndicator;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
@criccomini
criccomini / gist:3779272
Created September 25, 2012 00:24
Simple Login Screen - LoginViewController.h
#import <UIKit/UIKit.h>
@class LoginViewController;
@interface LoginAppAppDelegate : NSObject {
UIWindow *window;
LoginViewController *loginViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@criccomini
criccomini / gist:3779268
Created September 25, 2012 00:23
Simple Login Screen - LoginAppAppDelegate.m
#import "LoginAppAppDelegate.h"
#import "LoginViewController.h"
@implementation LoginAppAppDelegate
@synthesize window;
@synthesize loginViewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
@criccomini
criccomini / gist:3779265
Created September 25, 2012 00:22
Simple Login Screen - LoginAppAppDelegate.h
#import <UIKit/UIKit.h>
@class LoginViewController;
@interface LoginAppAppDelegate : NSObject {
UIWindow *window;
LoginViewController *loginViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@criccomini
criccomini / gist:3779260
Created September 25, 2012 00:21
Simple Login Screen - LoginViewController.m
#import "LoginViewController.h"
@implementation LoginViewController
@synthesize usernameField;
@synthesize passwordField;
@synthesize loginButton;
@synthesize loginIndicator;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {