Skip to content

Instantly share code, notes, and snippets.

Avatar

marchdown

  • Jerusalem
View GitHub Profile
View gist:37cd1c3cd0814e7ba0251b2f33aa1f92
python3 -m prodigy terms.teach seedterms_march11 ./radioner_with_bodypart_batch_trained -se seedterms.text
Initialising with 24 seed terms from seedterms.text
✨ Starting the web server at http://localhost:8080 ...
Open the app in your browser and start annotating!
15:15:54 - Task queue depth is 1
15:15:54 - Task queue depth is 2
^C
Saved 112 annotations to database SQLite
View practice online.html
<!doctype html>
<html lang="en, ru">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<title>Experiment</title>
@marchdown
marchdown / setup_p2_on_eu-west-1_with_ami-b43d1ec7.sh
Created Aug 5, 2017
Fast.ai setup script modified to use AMI available in eu-west-1 region.
View setup_p2_on_eu-west-1_with_ami-b43d1ec7.sh
export vpcId=`aws ec2 create-vpc --cidr-block 10.0.0.0/28 --query 'Vpc.VpcId' --output text`
aws ec2 modify-vpc-attribute --vpc-id $vpcId --enable-dns-support "{\"Value\":true}"
aws ec2 modify-vpc-attribute --vpc-id $vpcId --enable-dns-hostnames "{\"Value\":true}"
export internetGatewayId=`aws ec2 create-internet-gateway --query 'InternetGateway.InternetGatewayId' --output text`
aws ec2 attach-internet-gateway --internet-gateway-id $internetGatewayId --vpc-id $vpcId
export subnetId=`aws ec2 create-subnet --vpc-id $vpcId --cidr-block 10.0.0.0/28 --query 'Subnet.SubnetId' --output text`
export routeTableId=`aws ec2 create-route-table --vpc-id $vpcId --query 'RouteTable.RouteTableId' --output text`
aws ec2 associate-route-table --route-table-id $routeTableId --subnet-id $subnetId
aws ec2 create-route --route-table-id $routeTableId --destination-cidr-block 0.0.0.0/0 --gateway-id $internetGatewayId
export securityGroupId=`aws ec2 create-security-group --group-name my-security-group --description "Generated by setu
@marchdown
marchdown / reflexivity.idr
Created Aug 1, 2017
reflexivity in Idris
View reflexivity.idr
infixl 5
data (⇔) : a -> b -> Type where
Refl_ : x ⇔ x -- there is an identity, a function/path/morphism from a value of x of Type a to itself. /or to a value of an isomorphic type!/
fiveIsFive : 5 ⇔ 5
-- this is a function of type "equality" parametrized by "5" and "5" and since it has a constructor and is thus populated (by Refl), the Type with this parameters is populated and it is a proof that five does, indeed, equal itself.
fiveIsFive = Refl_
View gist:41420631fcfddbf2ed87cddb40e3fd9e
import rtmidi_python as rtmidi
from time import sleep
midi_out = rtmidi.MidiOut()
for port_name in midi_out.ports:
print port_name
midi_out.open_virtual_port("foo")
# now launch a DAW and connect to MIDI input "foo"
View foldr-all-the-things.hs
import Prelude hiding (takeWhile)
sum :: Num a => [a] -> a
sum = foldr (+) 0
product :: Num a => [a] -> a
product = foldr (*) 1
and :: [Bool] -> Bool
and = foldr (&&) True
-- NB pointful function definitions compile just fine without type annotations
and' xs = foldr (&&) True xs
View gist:7c4b38b6409d89e95c5c
main = do
getLine
pss <- read . lines . getContents
print $ foldr1 pss
-- list of numbers in the form of prime-power pairs
-- e.g. 35 would be [5 1 7 1]
gcd' _ [] = []
gcd' [] _ = []
View functional_kata.py
from functools import partial
def reduce(reducing_function, fs, initial_value=None):
fs = iter(fs)
v = fs.next() if initial_value is None else initial_value
for f in fs:
v = reducing_function(v, f)
return v
square = lambda x: x**2
View functional_kata.py
from functools import partial
def reduce(reducing_function, fs, initial_value=None):
fs = iter(fs)
v = fs.next() if initial_value is None else initial_value
for f in fs:
v = reducing_function(v, f)
return v
square = lambda x: x**2
You can’t perform that action at this time.