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
import Levenshtein as levenshtein | |
import numpy as np | |
def dist(coord): | |
i, j = coord | |
return levenshtein.distance(strings_list[i], strings_list[j]) | |
coords = np.triu_indices(len(strings_list), 1) | |
zipped_coords = zip(*coords) |
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
#!/bin/bash | |
# Clones a repo into an organized directory structure at your $CODEPATH. | |
# This organization is similar to how "go get" will organize your code into | |
# $GOPATH/<site>/../../<repo> | |
set -e | |
trap "echo ERRORS DETECTED" err |
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
#!/bin/bash | |
# Finds and converts git repositories in or under the working directory to | |
# reference GitHub Enterprise (code.redbrainlabs.com). | |
set -e | |
trap "echo ERRORS DETECTED" ERR | |
IFS="`printf '\n\t'`" |
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
using Images | |
using Match | |
function sample_S(n, iters=1000) | |
S = zeros(Int32, n) | |
for step = 1:iters | |
i = rand(1:n) | |
@match (i,S[i]) begin | |
(1,0),if S[i+1]==0 end => S[i]=1 | |
(1,0),if S[i+1]==1 end => continue |
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
install.packages('car') | |
df <- read.csv("~/data.csv") | |
plot(df) | |
# Model 1 | |
model1.y <- df$inf | |
model1.X <- df$unem |
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
import xml.etree.ElementTree as ET | |
@shared_task | |
def test_et(): | |
print('test_et') | |
fpath = '<xml-file>' | |
t = ET.parse(fpath) | |
print('--- t', t) |
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
-- Exercise 1 | |
invalidInt :: MaybeInt -> Bool | |
invalidInt (ValidInt _) = False | |
invalidInt InvalidInt = True | |
maybeIntValue :: MaybeInt -> Int | |
maybeIntValue (ValidInt val) = val | |
maybeIntValue InvalidInt = 0 |
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
-- Exercise 1 | |
formableBy :: String -> Hand -> Bool | |
formableBy [] _ = True | |
formableBy [letter] hand = letter `elem` hand | |
formableBy (letter:letters) hand | |
| letter `elem` hand = formableBy letters (delete letter hand) | |
| otherwise = 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
-- Exercise 1 | |
lastDigit :: Integer -> Integer | |
lastDigit x = mod x 10 | |
dropLastDigit :: Integer -> Integer | |
dropLastDigit x = div x 10 | |
-- Exercise 2 |
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
➜ data git:(master) ✗ cat b12.dat | java vehicle | java -jar ../target/satellite.jar | |
3 12122.917273542467 2.60523431377833E7 2986153.9652811266 4264669.833341302 | |
4 12122.918115953327 -1.7183556330883846E7 -1.8640834276143264E7 7941901.319790134 | |
8 12122.915172212155 1.849827925650694E7 -1.417239006512881E7 -1.2758766854626015E7 | |
11 12122.929474066532 -2903225.428341161 -1.966135853793516E7 1.7630410370027628E7 | |
14 12122.930816872351 1477645.0131373822 -1.521487230845357E7 2.1729089560153764E7 | |
15 12122.915592052117 2.652632365288924E7 847508.5773716164 -1210367.6854701233 | |
17 12122.932126745905 4939777.113827618 -1.7965663283148237E7 1.8938390959181942E7 | |
20 12122.930290188273 1.7903461115956523E7 -1.680512822045815E7 1.0143118496003771E7 | |
3 12123.917274955005 2.6051583575288303E7 2988333.2598301014 4267782.188507524 |