Skip to content

Instantly share code, notes, and snippets.

View srli's full-sized avatar

Sophia Li srli

View GitHub Profile
@srli
srli / itunes_playlist_get.applescript
Last active November 26, 2020 17:20
Playlist_Exporter
(*This is the AppleScript component to the iTunes -> Spotify playlist sync program
Written by Sophie Li: 12/29/16*)
try
tell application "Finder"
delete (every item of folder (((path to home folder) as text) & "Scripts:playlist_sync:playlists") whose name ends with ".xml")
end tell
on error errMsg number errNum
display dialog "Error " & errNum & return & return & errMsg buttons {"Cancel"} default button 1
end try
#!/usr/bin/env python
"""
This code generates the path required for a knight's tour
around a chessboard with user-specified dimensions
Written by Sophie Li, 2016
http://blog.justsophie.com/algorithm-for-knights-tour-in-python/
"""
import sys
@srli
srli / stt.py
Last active July 26, 2020 23:40
#!/usr/bin/env python
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import os
import pyaudio
import wave
import audioop
from collections import deque
from random import *
from math import *
import random
from PIL import Image
def build_random_function(min_depth, max_depth):
""" Builds a random function of depth at least min_depth and depth
at most max_depth (see assignment writeup for definition of depth
in this context)
import random
import math
from PIL import Image
def lambda_function(min_depth, max_depth):
prod = lambda x,y: x*y
avg = lambda x,y: .5*(x+y)
cos_pi = lambda x,y: math.cos(math.pi*x)
sin_pi = lambda x,y: math.sin(math.pi*x)
sqr = lambda x,y: x**2
@srli
srli / The Technical Interview Cheat Sheet.md
Created October 28, 2015 17:12 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.