Skip to content

Instantly share code, notes, and snippets.

View srli's full-sized avatar

Sophia Li srli

View GitHub Profile
@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.
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
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)
@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
#!/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 / 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
@srli
srli / spi_tester.c
Last active October 26, 2016 00:18
Updated spi_tester.c
/******************************************************************************
*
* Copyright (C) 2009 - 2014 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@srli
srli / tour.py
Last active February 9, 2017 04:43
Better Knights Tour w/ visualizer
#!/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, 2017
http://blog.justsophie.com/algorithm-for-knights-tour-in-python/
"""
import sys
@srli
srli / image_steganography.py
Created March 5, 2017 20:37
Hide text in images using steganography!
"""A program that encodes and decodes hidden messages in images through LSB steganography"""
from PIL import Image, ImageFont, ImageDraw
import textwrap
def decode_image(file_location="images/encoded_sample.png"):
"""Decodes the hidden message in an image
file_location: the location of the image file to decode. By default is the provided encoded image in the images folder
"""
encoded_image = Image.open(file_location)
@srli
srli / ros_simple_sample.py
Last active December 17, 2017 02:32
Simple implmentation of a ros node in python
#!/usr/bin/python
import rospy
from std_msgs.msg import String
from sensor_msgs.msg import Image
import cv2
import numpy as np
class FaceFinder:
def __init__(self):