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
| from lark import Lark, Transformer | |
| grammar = r""" | |
| %import common.WORD | |
| %import common.INT | |
| %import common.WS | |
| %ignore WS | |
| _arrow : "->" | "→" |
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
| from github import Github | |
| from csv import DictWriter | |
| from sys import argv | |
| # loads the auth key from ~/.github-oauth-key | |
| from os.path import expanduser, join | |
| GITHUB_OAUTH_KEY = open(join(expanduser('~'),'.github-oauth-key')).read().strip() | |
| g = Github(GITHUB_OAUTH_KEY) | |
| reponame = argv[1] |
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
| #!/usr/bin/env python3 | |
| # Sample random lines from a file on standard input, writing to standard output | |
| # first command line argument is probability with which to return a row that is read | |
| # second command line argument is something evaluating to a boolean indicating whether the file has a header | |
| # if True, the header (first line) will always be sent through to the output | |
| # third command line argument will manually set the seed if present so as to make the results reproducible, | |
| # else seed will come from OS-determined random source | |
| # Usage: |
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
| from collections import defaultdict | |
| from sys import intern | |
| class Coder: | |
| """ | |
| Creates sequential ids for objects and keeps track of them | |
| useful e.g. for filling out a matrix with info related to objects | |
| and translating back and forth between matrix indices and the objects | |
| """ | |
| def next_id(self): |
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
| from pylab import * | |
| from scipy.stats import * | |
| num_adults = 227e6 | |
| basic_income = 7.25*40*50 | |
| labor_force = 154e6 | |
| disabled_adults = 21e6 | |
| current_wealth_transfers = 3369e9 | |
| def jk_rowling(num_non_workers): |
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/bash | |
| if [ `whoami` != "root" ] | |
| then | |
| echo "My full name is Sudo Genki." | |
| exit 1 | |
| fi | |
| if [ `which vlc-wrapper` = "vlc-wrapper not found" ] | |
| then | |
| echo "Sudo Genki requires vlc." |
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
| import scala.language.implicitConversions | |
| implicit class SubSeq[T](s: Seq[T]) { | |
| def commonSubsequence(t:Seq[T]) : Set[IndexedSeq[T]] = { | |
| val seq1 = s | |
| import collection.immutable.{Set,HashSet,HashMap}; | |
| var memo = new HashMap[(Int,Int),List[List[T]]]() | |
| def retrace(c:Array[Array[Int]], i:Int, j:Int, x:IndexedSeq[T], y:IndexedSeq[T]): List[List[T]] = { | |
| if(memo.contains(i,j)) { |
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
| Host * | |
| # ForwardAgent no | |
| ForwardX11 yes | |
| ForwardX11Trusted yes | |
| # RhostsRSAAuthentication no | |
| # RSAAuthentication yes | |
| # PasswordAuthentication yes | |
| # HostbasedAuthentication no | |
| # GSSAPIAuthentication no | |
| # GSSAPIDelegateCredentials no |