Skip to content

Instantly share code, notes, and snippets.

View TomLisankie's full-sized avatar

Thomas Lisankie TomLisankie

View GitHub Profile
//
// Phoneme.swift
import Foundation
class Phoneme {
private var isAVowelPhoneme = false;
private var phoneme = "";

Keybase proof

I hereby claim:

  • I am tomlisankie on github.
  • I am tomlisankie (https://keybase.io/tomlisankie) on keybase.
  • I have a public key ASDtfZsxg2L_K02VywkZHxguyaA6ktChswzMW5rFWuwOrwo

To claim this, I am signing this object:

#fit_model code:
# TODO: Import 'make_scorer', 'DecisionTreeRegressor', and 'GridSearchCV'
from sklearn.tree import DecisionTreeRegressor
from sklearn.metrics import make_scorer
from sklearn.model_selection import GridSearchCV
def fit_model(X, y):
""" Performs grid search over the 'max_depth' parameter for a
decision tree regressor trained on the input data [X, y]. """
@TomLisankie
TomLisankie / min-char-rnn.py
Created June 24, 2018 16:35 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
lisp = input("Enter your Lisp code: ")
# splits Lisp expression into tokens and strips them of whitespace.
def makeTokens(lisp):
lispTokens = lisp.replace("(", " ( ").replace(")", " ) ").split()
return [token.strip() for token in lispTokens]
# if the token is a number, return it as the appropriate type (int or float).
# otherwise, return it as a string
def createAtom(token):
@TomLisankie
TomLisankie / cons_cells.py
Created May 4, 2019 23:42
Implementing Lisp `cons`, `car`, and `cdr` in Python
# Was watching this (https://www.youtube.com/watch?v=ymsbTVLbyN4&t=3749s) and Abelson was talking about how you could just make a cons cell with a lambda. Remembered Python had lambdas (although they're one-line lambdas smh) and figured "why not"
def cons(a, b):
return lambda x: a if (x == 1) else b
def car(cell):
return cell(1)
def cdr(cell):
return cell(2)
@TomLisankie
TomLisankie / index.html
Created June 14, 2019 00:00
JavaScript Piano
<body>
<section id="wrap">
<header>
<h1>JS Piano</h1>
<h2>Use your keyboard. Hover for hints.</h2>
</header>
<section id="main">
<div class="nowplaying"></div>
<div class="keys">
<div data-key="65" class="key" data-note="C">

Keybase proof

I hereby claim:

  • I am tomlisankie on github.
  • I am tomlisankie (https://keybase.io/tomlisankie) on keybase.
  • I have a public key ASBhm5XsEEr_hU3yukeOfhHBJ3IvBOvWfLXXsYoBHrXUdAo

To claim this, I am signing this object:

(ns cryptopals-clj.core)
(defn hex-string->base64-string
"converts hex string to base64 string"
[original-hex-string]
(let [hex-string->hex-byte-array (fn [hex-string]
(let [convert (fn [string hex-bytes]
(if (empty? string)
hex-bytes
;; Problem 46
(fn [f]
(fn [& args]
(apply f (reverse args))))
;; Problem 44
(fn [number coll]
(if (> number 0)
(concat (second (split-at (mod (+ (count coll) number) (count coll)) coll)) (first (split-at (mod (+ (count coll) number) (count coll)) coll)))
(concat (second (split-at (mod (- (+ (count coll) 1) number) (count coll)) coll)) (first (split-at (mod (- (+ (count coll) 1) number) (count coll)) coll)))))