Instantly share code, notes, and snippets.

shu.chensirpengi

• Sort options
Created Mar 31, 2014
keybase.md
View keybase.md

Keybase proof

I hereby claim:

• I am sirpengi on github.
• I am sirpengi (https://keybase.io/sirpengi) on keybase.
• I have a public key whose fingerprint is EF6E FAE9 4D6B CA66 8EA2 4C1F B6BE 3624 D5BC 9DA1

To claim this, I am signing this object:

Last active Aug 29, 2015
roll20 bug
View error.js
 on("ready", function() { var n = +new Date(); var obj = createObj("rollabletable", { name: String(n) }); obj.set("name", "post_" + n); });
Last active Aug 29, 2015
proggitquiz
View question
 "If the integers from 1 to 999,999,999 are written as words, sorted alphabetically, and concatenated, what is the 51 billionth letter?" To be precise: if the integers from 1 to 999,999,999 are expressed in words (omitting spaces, 'and', and punctuation[1]), and sorted alphabetically so that the first six integers are eight
Created Feb 27, 2014
Look at that O(n)
View output.txt
 [sirpengi@localhost tmp]\$ python anagrams.py ############# (1.31171178818) ################ (1.60090017319) ################### (1.9009168148) ###################### (2.23292398453) ######################### (2.55905890465)
Created Feb 27, 2014
View anagram.py
 from collections import Counter with open("/usr/share/dict/words") as fh: solutions = {} for i, line in enumerate(fh.readlines()): if i > 100000: break w = line.lower().strip() h = tuple(sorted(Counter(w).elements())) if h not in solutions: solutions[h] = set()
Created Nov 26, 2013
Lol, paypal's short message is longer than the long message.
View lolpaypal.txt
 DoExpressCheckoutPayment failed: { 'ACK': 'Failure', 'TIMESTAMP': '2013-11-26T03:18:22Z', 'L_SEVERITYCODE0': 'Error', 'L_SHORTMESSAGE0': 'Transaction refused because of an invalid argument. See additional error messages for details.', 'L_LONGMESSAGE0': 'A successful transaction has already been completed for this token.', ... }
Created Nov 18, 2013
View gist:7536374
 500 Internal Server Error Sorry, something went wrong. A team of highly trained monkeys has been dispatched to deal with this situation. If you see them, show them this information: q8tvTqOwLT5ji9a9wG0Llddj-MDpqyJ1XouR3hxmRuTNbNcu_KX36T9aJ2fw iI0gqMVvBdrg-N1MWH8UZazCKQlx2BQ-Q8c356TX-pioVoQgyfyHoLcvHJOn 7Va6HYO_aRWC0Y1oYX1ael5_BrqOBS-G87TTPZijllTyuswFiilV20k9ICve
Created Sep 13, 2013
diagonal sum in clojure
View diagonal-sum.clj
 (ns diagonal-sum) (defn ds-step [[v prev step]] [(+ v (* 4 prev) (* 10 step)) (+ prev (* 4 step)) (+ step 2)]) (defn ds-seq [] (map first (iterate ds-step [1 1 2]))) (println (take 10 (ds-seq)))
Created Jul 28, 2013
View test.json
 { "v": 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 }
Created Jul 15, 2013
perl-yaml
View blah.output
 [root@crap log]# yum search yaml | grep -i perl perl-CPAN-Meta-YAML.noarch : Read and write a subset of YAML for CPAN Meta files perl-Test-YAML-Valid.noarch : Lets you test the validity of YAML files in unit perl-YAML.noarch : YAML Ain't Markup Language (tm) perl-YAML-Parser-Syck.i686 : Perl Wrapper for the YAML Parser Extension: libsyck perl-YAML-LibYAML.i686 : Perl YAML Serialization using XS and libyaml perl-YAML-Syck.i686 : Fast, lightweight YAML loader and dumper perl-YAML-Tiny.noarch : Read/Write YAML files with as little code as possible perl-Test-CPAN-Meta-YAML.noarch : Validate a META.yml file within a CPAN perl-Test-YAML-Meta.noarch : Validation of the META.yml file in a distribution
You can’t perform that action at this time.