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
git tips & tricks | |
0. cloning | |
git clone ./repo ./clone # do a local clone | |
1. the index / patch mode | |
git add -p |
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 python2 | |
# encoding: utf-8 | |
from __future__ import print_function | |
import sqlalchemy as sqla | |
from sqlalchemy import orm, types | |
from sqlalchemy.sql.expression import bindparam | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.ext.associationproxy import association_proxy | |
metadata = sqla.MetaData() |
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
id │ identifier │ id │ identifier │ efficacy | |
───────┼───────────────────────┼────┼────────────┼────────── | |
1 │ bulbasaur │ 11 │ water │ 50 | |
2 │ ivysaur │ 11 │ water │ 50 | |
3 │ venusaur │ 11 │ water │ 50 | |
10033 │ venusaur-mega │ 11 │ water │ 50 | |
4 │ charmander │ 11 │ water │ 200 | |
5 │ charmeleon │ 11 │ water │ 200 | |
6 │ charizard │ 11 │ water │ 200 | |
10034 │ charizard-mega-x │ 11 │ water │ 100 |
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 hy | |
(def N 999) | |
(def a (+ [1 1] (* [0] N))) | |
(let [(i 1) (j 0)] | |
(while (< i N) | |
(if (= i j) (print i)) | |
(cond | |
[(> j N) (setv j 0)] | |
[(>= j i) (do (setv (get a j) 1) | |
(setv j (+ j i)))] |
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 | |
N = 99999 | |
a = [1,1] + [0]*N | |
i = 1 | |
j = 0 | |
while i < N: | |
if i == j: | |
print(i) |
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
package main | |
// Implementation of a GLL parser, from | |
// | |
// Elizabeth Scott and Adrian Johnstone. "GLL Parsing". LTDA 2009, pp 113-126 | |
// http://ldta.info/2009/ldta2009proceedings.pdf | |
// | |
// ...with some modifications ;) | |
import ( |
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
type node = { accept: bool; links: link list } | |
and link = Link of char * node | |
type nfa_type = NFA of node list * node | |
type regexp = | |
| Empty | |
| Epsilon | |
| Single of char |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"time" | |
) | |
type pair struct{ End, Start Point } |
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
def quicksort(list): | |
#print "quick>", list | |
if len(list) <= 1: | |
return list | |
pivot = list[len(list)//2] | |
a = mergesort([x for x in list if x <= pivot]) | |
b = mergesort([x for x in list if not x <= pivot]) | |
#print "quick<", a+b | |
return a + b |
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 Control.Monad (fail) | |
import Control.Monad.Trans (lift, liftIO) | |
import Text.Parsec ((<|>), (<?>)) | |
import Text.Read (readMaybe) | |
import System.IO (hFlush, stdout) | |
import qualified Control.Monad.Trans.State.Strict as State | |
import qualified Data.HashMap.Strict as HashMap | |
import qualified Text.Parsec as P |