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
class Test { | |
public static void main(String[] args) { | |
Pattern pattern = Pattern.compile( "filename\\*\\d+" ); | |
System.out.println( pattern.matcher( "filename1" ).find() ); // false | |
System.out.println( pattern.matcher( "filename*1" ).find() ); // true | |
System.out.println( pattern.matcher( "filename*12" ).find() ); // true | |
System.out.println( pattern.matcher( "filename**12" ).find() ); // false | |
System.out.println( pattern.matcher( "filenamme*12" ).find() ); // false | |
System.out.println( pattern.matcher( " filename**12 =" ).find() ); // false | |
System.out.println( pattern.matcher( " filename**12=" ).find() ); // false |
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
class Test { | |
public static void main( String[] args ) | |
{ | |
final String contentDisposition = "name: Content-Disposition\n" + | |
"value: attachment;\n" + | |
"\tsize=1123785;\n" + | |
"\tmodification-date=\"Thu, 20 Aug 2015 17:27:44 GMT\";\n" + | |
"\tfilename*0=\"=?utf-8?B?TmltciAoNCDDlyA0KSBhbmQgKDYgw5cgNikgaGlnaCBtb2JpbGl0eS\";\n" + | |
"\tfilename*1=\"B2ZWhp?= cles.pdf\";\n" + | |
"\tcreation-date=\"Thu, 20 Aug 2015 17:27:44 GMT\""; |
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
# A list of mail headers to test against | |
# Outlook | |
Content-disposition: attachment; | |
filename=";;;.txt" | |
# Outlook | |
Content-disposition: attachment; | |
filename*=UTF-8''%3B%E6%BC%A2%D8%B1%D9%82%D9%84%20%3B%3BDonaldTrump%E6%BC%A2%D8%B1%D9%82%D9%84%20%E6%BC%A2%D8%B1%D9%82%D9%84%20%E6%BC%A2%D8%B1%D9%82%D9%84%20%E6%BC%A2%D8%B1%D9%82%D9%84%20%E6%BC%A2%D8%B1%D9%82%D9%84%20%E6%BC%A2%D8%B1%D9%82%D9%84%20longTheDonald.txt |
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_ |
OlderNewer