Skip to content

Instantly share code, notes, and snippets.

@mr-nano
mr-nano / understanding-word-vectors.ipynb
Created September 4, 2020 17:40 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mr-nano
mr-nano / output - when executed in zepplein
Created May 16, 2020 07:57
Getting the current stacktrace
java.lang.Thread.getStackTrace(Thread.java:1559)
$line987107314138.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:103)
$line987107314138.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:108)
$line987107314138.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:110)
$line987107314138.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init
@mr-nano
mr-nano / .sbt
Created March 26, 2020 02:57
Processing
name := "processing"
version := "0.1"
scalaVersion := "2.13.0"
resolvers += "OSS SNAPSHOTS" at "https://oss.sonatype.org/content/repositories/snapshots"
resolvers += "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
libraryDependencies += "org.processing" % "core" % "3.3.7"
@mr-nano
mr-nano / .block
Created January 14, 2020 07:51
Film Flowers Petal Starter Code
license: gpl-3.0
@mr-nano
mr-nano / sh
Created October 18, 2018 18:23
Using seq in bash
for i in $seq(1 9); do
echo play :A$i; echo sleep sleepTime
done | pbcopy
@mr-nano
mr-nano / py
Created April 20, 2018 03:59
print all html file names from directory (python)
import glob, os
os.chdir(healthcare_files_directory)
for file in glob.glob("*.htm"):
print(file)
@mr-nano
mr-nano / .scala
Created September 28, 2016 06:58
Secret of Product with Serializable
trait Animal
trait FurryAnimal extends Animal
case class Dog(name:String) extends Animal
case class Cat(name:String) extends Animal
val x:Array[Product with Serializable with Animal] = Array(Dog(Fido),Cat(Felix))
/*
Why is x with this type.
Unlike case class Dog and Cat, your trait Animal does not extend Product or Serializable. Hence the type signature you see.
@mr-nano
mr-nano / read_first_n_csv_lines_As_dict.py
Created August 30, 2016 18:11
Reading csv files as array of dictionaries..
import os,csv
def parse_file(datafile):
data = []
csv_reader = csv.DictReader(open(datafile))
return [next(csv_reader) for row_number in xrange(10)]
@mr-nano
mr-nano / read_first_n_lines.py
Created August 30, 2016 17:57
Reading first n lines out of a file in python
with open("datafile") as myfile: # probably an efficient one, but doesn't work for files less than N lines.
head = [next(myfile) for x in xrange(N)]
########################################################
from itertools import islice # less efficient maybe but works for files less than N lines
with open("datafile") as myfile:
head = list(islice(myfile, N))
#######################################################
@mr-nano
mr-nano / build.gradle
Last active August 23, 2016 07:59
Gradle - class inside build file
class HelloWorld {
public void printSomething() {
System.out.println("HelloWorld");
}
}
new HelloWorld().printSomething()