This file contains 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
while true; do for i in `seq 1 30`; do echo $i; sleep 1; done; tput bel; tput bel; done |
This file contains 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 | |
# input: branches.txt lists feature branches | |
# branches MUST be on their own line | |
# branches MUST be ordered NEWEST to OLDEST | |
# output: the git command to rebase linear branches onto 'develop' | |
import sys | |
BRANCH = 'develop' |
This file contains 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 | |
# python install_facebook_aar.py 3.17 | |
# if you want to install version 3.17 of the Facebook Android SDK | |
if __name__ == "__main__": | |
import sys | |
if len(sys.argv) is not 2: | |
print "Example run command:" | |
print "python install_facebook_aar.py 3.17" | |
else: | |
version = sys.argv[1] |
This file contains 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/ruby | |
# Remove duplicates from array in linear time | |
arr = [6,2,4,2,4,6] | |
puts "#{arr.size} elements in original array:" | |
puts arr.inspect | |
# keep track of what we see | |
seen = {} |
This file contains 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/ruby | |
def isBalanced(string) | |
stack = [] | |
string.split("").each do |i| | |
if i == '(' | |
stack.push i | |
elsif i == ')' | |
popped = stack.pop | |
return false if popped == nil |
This file contains 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/ruby | |
# Detect if property of max heap is violated. | |
# Heap is a tree-based data structure. | |
# Here we use a binary tree. | |
# Must be monotonically decreasing from parent to child. | |
class Node | |
def initialize(value, left, right) | |
@value = value |
This file contains 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
#delimit ; | |
cap log close; | |
cd "~/Dropbox/econ381_project"; | |
log using "project.log", text replace; | |
insheet using "health_status.csv", comma; | |
reshape long | |
all_ne_evg_ all_ne_g_ all_ne_fp_ | |
all_mw_evg_ all_mw_g_ all_mw_fp_ | |
all_s_evg_ all_s_g_ all_s_fp_ |
This file contains 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 balanced?(string) | |
braces = 0 | |
parens = 0 | |
string.split("").each do |i| | |
if i == "(" | |
parens += 1 | |
elsif i == ")" | |
parens -= 1 | |
elsif i == "[" | |
braces += 1 |
This file contains 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
package com.niupiao.niupiao.utils; | |
import org.joda.time.DateTime; | |
import org.joda.time.format.DateTimeFormat; | |
import org.joda.time.format.DateTimeFormatter; | |
import org.joda.time.format.ISODateTimeFormat; | |
/** | |
* Created by kevinchen on 2/23/15. | |
*/ |
This file contains 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
public class BasicStack { | |
private Object[] array = null; | |
private boolean debug = false; | |
public BasicStack() { | |
this(10); | |
} | |
public BasicStack(int capacity) { |
OlderNewer