Skip to content

Instantly share code, notes, and snippets.

View kylemsguy's full-sized avatar

Kyle Zhou kylemsguy

  • SF Bay Area
View GitHub Profile
/*
The MIT License (MIT)
Copyright (c) 2014 Kyle Zhou
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
public class Car {
// instance variables
private float fuel;
private boolean started;
private int distanceTravelled;
// static variable to keep track how many cars there are GLOBALLY.
private static int numCars = 0;
private static final float mileage = 0.15; // constant for mileage in L/km
@kylemsguy
kylemsguy / gist:84ecef55d046bb552c24
Last active August 29, 2015 14:02
tcas-app-logcat
06-18 13:52:39.166: I/System.out(15676): Sending 'GET' request to URL : http://twocansandstring.com/login/
06-18 13:52:39.166: I/System.out(15676): Response Code : 200
06-18 13:52:39.186: I/System.out(15676): Extracting form's data...
06-18 13:52:39.977: I/System.out(15676): Sending 'POST' request to URL : http://twocansandstring.com/login/
06-18 13:52:39.977: I/System.out(15676): Post parameters : login_username=AppTester&login_password=CENSOR&submit=Loggest+In
06-18 13:52:39.977: I/System.out(15676): Response Code ... 302
06-18 13:52:40.368: I/System.out(15676): Sending 'GET' request to URL : http://twocansandstring.com/apiw/qa/getquestion/
06-18 13:52:40.368: I/System.out(15676): Response Code : 200
06-18 13:52:40.378: I/System.out(15676): Login Failed
06-18 13:52:40.728: I/System.out(15676): Sending 'GET' request to URL : http://twocansandstring.com/apiw/qa/getquestion/
@kylemsguy
kylemsguy / PKMN_GSC_TIME
Last active August 29, 2015 14:04
Calculates the password to change the time in Pokemon GSC
# Derived from http://www.pokezam.com/games/gameboy/gold/tc.js
# Usage: either import gen_pkmn_timecode or run directly
# NOTE: Pk is represented by + and Mn is represented by =
# e.g. if name is Kyle(Pk)(Mn) then type Kyle+=
#
# To access password screen (Source: Bulbapedia):
# G/S: Hold Down, Select, and B
# Crystal: Hold Down, Select, and B
# Release Down and B while still holding Select
# Press Left and Up while still holding Select
@kylemsguy
kylemsguy / Makefile
Created October 29, 2014 03:35
Arduino Leonardo CLI Flasher
## Taken from
## http://nicholaskell.wordpress.com/2012/08/11/arduino-leonardo-upload-from-makefile/
PORT = /dev/ttyACM1
HEXFILE = ./LEONARDO_16664.hex
burn:
python reset.py $(PORT)
sleep 2
avrdude -patmega32u4 -cavr109 -P$(PORT) -b57600 -D -Uflash:w:./$(HEXFILE):i
@kylemsguy
kylemsguy / Makefile
Created October 31, 2014 07:37
LaTeX document Makefile
all: a2.pdf a2.log a2.aux a2.synctex.gz
a2.pdf: a2.tex
pdflatex -synctex=1 -interaction=nonstopmode "a2".tex
clean:
rm a2.log a2.aux a2.synctex.gz a2.pdf
@kylemsguy
kylemsguy / gist:4334cdf67d17046d39e1
Created November 6, 2014 05:47
Quick Verilog ASCII generator
def get_ascii_hex(s:str):
[print("8'h", hex(ord(i))[2:].upper(), sep='') for i in s]
@kylemsguy
kylemsguy / test.py
Created December 14, 2014 23:56
Q&D automate package tracking
import re
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
tracking_number = ('')
browser = webdriver.Firefox()
browser.get("https://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber")
@kylemsguy
kylemsguy / billproblem.py
Last active October 2, 2015 07:24
Bill problem inspired by MinutePhysics (https://www.youtube.com/watch?v=eivGlBKlK6M)
## Inspired by an episode of MinutePhysics
# You can find a link to the original video here: https://www.youtube.com/watch?v=eivGlBKlK6M
# The algorithm used here is from https://www.youtube.com/watch?v=C5-I0bAuEUE
# but you should really watch the first one first
import sys
from random import shuffle
class Box:
def __init__(self, bill):
self.bill = bill
@kylemsguy
kylemsguy / hide_quora_nag.js
Created June 16, 2017 02:20
Hide the Quora login nag screen
// Simply copy the following line into the dev console while on the page with the nag screen.
// Alternatively, paste it into a bookmarklet.
document.getElementsByClassName("modal_signup_background")[0].parentNode.style.display = "none";document.getElementsByTagName("body")[0].style.overflow = "auto";