Skip to content

Instantly share code, notes, and snippets.

View martinraison's full-sized avatar

Martin Raison martinraison

View GitHub Profile
@martinraison
martinraison / demo.py
Last active October 21, 2018 18:26
sparse pytorch embedding demo
import argparse
from collections import Counter
import csv
import os
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import tarfile
@martinraison
martinraison / facetime.applescript
Last active February 7, 2016 19:51
Calling someone from the OSX terminal
#!/usr/bin/env osascript
-- usage: facetime johndoe@xyz.com
on run {contact}
do shell script "open facetime://" & contact
tell application "System Events"
repeat while not (button "Call" of window 1 of application process "FaceTime" exists)
delay 1
end repeat
click button "Call" of window 1 of application process "FaceTime"
end tell
@martinraison
martinraison / test.clj
Last active October 17, 2015 07:22
Extract english words following a given pattern
;; List from http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt
(defn find-words []
(->> "wordsEn.txt"
slurp
clojure.string/split-lines
(filter #(re-matches #"^s.a..$" %))))
;; Output
("scabs" "scads" "scags" "scald" "scale" "scalp" "scaly" "scamp" "scams"
"scans" "scant" "scape" "scare" "scarf" "scarp" "scars" "scary" "scats"