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
| class MnemonicsCoder(words: List[String]) { | |
| private val mnemonics = Map('2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", | |
| '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") | |
| /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ | |
| private val charCode: Map[Char, Char] = | |
| for ((digit, str) <- mnemonics; letter <- str) yield (letter -> digit) | |
| /** Maps a word to the digit string it can represent */ |
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
| #!/bin/zsh | |
| # Global virtualenvwrapper postactivate, lives in $WORKON_HOME/postactivate | |
| # Remove virtual env from start of PS1 as it's in RPROMPT instead | |
| PS1="$_OLD_VIRTUAL_PS1" | |
| PROJECT_DIR="$HOME/projects/$(basename $VIRTUAL_ENV)" | |
| if [ -d $PROJECT_DIR ]; then | |
| # If we aren't already within the project dir, cd into it |
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 <stdio.h> | |
| int main(int argc, char **argv) { | |
| FILE *fp; | |
| char mc ; | |
| fp = fopen(argv[1],"r") ; | |
| printf("Reading contents of file\n"); | |
| while((mc = (char) fgetc (fp)) != EOF) { |
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
| ## An attempt to query the data here: http://en.wikipedia.org/wiki/Comparison_of_Internet_Relay_Chat_clients | |
| ## via http://dbpedia.org/spraql to determine which IRC clients for Windows are GPL licensed | |
| prefix dbo: <http://dbpedia.org/ontology/> | |
| prefix dbpprop: <http://dbpedia.org/property/> | |
| prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
| prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
| prefix yago: <http://dbpedia.org/class/yago/> | |
| select distinct ?client ?label ?license ?os |
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
| <html> | |
| <body> | |
| <form action="prime_birthday.php" method="post"> | |
| Day: <input type="text" name="day" /> | |
| Month: <input type="text" name="mon" /> | |
| Year: <input type="text" name="year" /> | |
| <input type="submit" /> | |
| </form> |
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
| curl -H "Accept: application/sparql-results+xml" "http://localhost:8000/sparql/" --data-urlencode "query=SELECT ?s ?p ?o { ?s ?p ?o . }" |
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
| $ curl -O http://openjena.org/repo-dev/com/hp/hpl/jena/tdb/0.8.10-SNAPSHOT/tdb-0.8.10-20110325.114138-12.zip | |
| ... | |
| $ unzip tdb-0.8.10-20110325.114138-12.zip | |
| ... | |
| $ export TDBROOT=TDB-0.8.10-SNAPSHOT | |
| $ PATH=$TDBROOT/bin:$PATH | |
| $ curl -O http://downloads.dbpedia.org/3.6/en/external_links_en.nt.bz2 | |
| $ curl -O http://downloads.dbpedia.org/3.6/en/article_categories_en.nt.bz2 | |
| $ curl -O http://downloads.dbpedia.org/3.6/en/homepages_en.nt.bz2 | |
| $ bzcat *.bz2 | tdbloader2 --loc DBpedia /dev/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
| """ | |
| An implementation of binary search, based on the challanges in the following blog posts: | |
| http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html | |
| http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/ | |
| http://www.solipsys.co.uk/new/BinarySearchReconsidered.html?tw | |
| This was not my first attempt however, there was a broken version (of course) | |
| that I wrote prior to running it for the first time. Sadly I didn't take a | |
| snapshot before I fixed it but the bug was fairly major; although I'd worked |
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
| let primes = [2,3,5,7] in let mult (x,y) = x*y in let {f 0 ls = ls ; fn ls = map mult (zip primes (f (n-1) ls)) } in f 3 primes |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.