Skip to content

Instantly share code, notes, and snippets.

@leimd
leimd / README.md
Created November 14, 2022 19:53
AWS Reinvent Scripts

AWS Re:Invent Scripts

Add these into your browser

Open Chrome Developer console, navigate to Source -> Snippets -> Add new

How to run

In AWS Re:Invent web portal, set up filters for your sessions

  1. Run reinvent-scroll to scroll all the way to bottom.
  2. Run reinvent-hild-unavailable to hide all unavailable sessions.
@leimd
leimd / crime-rate.csv
Created March 6, 2017 01:12
crime-rate.csv
We can't make this file beautiful and searchable because it's too large.
ID,Case Number,Date,Block,IUCR,Primary Type,Description,Location Description,Arrest,Domestic,Beat,District,Ward,Community Area,FBI Code,X Coordinate,Y Coordinate,Year,Updated On,Latitude,Longitude,Location
10854708,JA159682,09/01/2016 12:00:00 AM,027XX S INDIANA AVE,1153,DECEPTIVE PRACTICE,FINANCIAL IDENTITY THEFT OVER $ 300,RESIDENCE,false,false,0133,001,2,35,11,,,2016,02/20/2017 03:49:59 PM,,,
10821133,JA121660,09/01/2016 12:00:00 AM,045XX N BROADWAY,1110,DECEPTIVE PRACTICE,BOGUS CHECK,RESIDENCE,false,false,1913,019,46,3,11,,,2016,01/20/2017 03:50:54 PM,,,
10798858,HZ568985,09/01/2016 12:00:00 AM,026XX W 60TH ST,1153,DECEPTIVE PRACTICE,FINANCIAL IDENTITY THEFT OVER $ 300,APARTMENT,false,false,0824,008,16,66,11,,,2016,12/30/2016 03:57:27 PM,,,
10784101,HZ552025,09/01/2016 12:00:00 AM,081XX S HARVARD AVE,1753,OFFENSE INVOLVING CHILDREN,SEX ASSLT OF CHILD BY FAM MBR,RESIDENCE,false,true,0622,006,21,44,02,,,2016,12/29/2016 03:52:46 PM,,,
10793525,HZ564093,09/01/2016 12:00:00 AM,046XX N BEACON ST,2825,OTHER OFFE
@leimd
leimd / pokedex.csv
Last active July 23, 2019 05:58
pokedex.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 21 columns, instead of 2. in line 9.
CAUGHT,DEX#,POKEMON ,FORM,TYPE 1,TYPE 2,ABILITIES 1,ABILITIES 2,HIDDEN ABILITY,EVOLUTION DETAILS,EGG GROUPS,,BASE STATS,,,,,,,OBTAINABLE IN,
,,,,,,,,,,EG 1,EG 2,HP,ATK,DEF,SP.ATK,SP.DEF,SPEED,TOTAL,POKEMON XY,POKEMON ORAS
,#001,Bulbasaur,-----,Grass,Poison,Overgrow,-----,Chlorophyll,Level Up - 16,Monster,Grass,45,49,49,65,65,45,318,YES,NO
,#002,Ivysaur,-----,Grass,Poison,Overgrow,-----,Chlorophyll,Level Up - 32,Monster,Grass,60,62,63,80,80,60,405,YES,NO
,#003,Venusaur,-----,Grass,Poison,Overgrow,-----,Chlorophyll,-----,Monster,Grass,80,82,83,100,100,80,525,YES,NO
,#003,Venusaur,Mega,Grass,Poison,Thick Fat,-----,-----,-----,-----,-----,80,100,123,122,120,80,625,YES,YES
,#004,Charmander,-----,Fire,-----,Blaze,-----,Solar Power,Level Up - 16,Monster,Dragon,39,52,43,60,50,65,309,YES,NO
,#005,Charmeleon,-----,Fire,-----,Blaze,-----,Solar Power,Level Up - 36,Monster,Dragon,58,64,58,80,65,80,405,YES,NO
,#006,Charizard,-----,Fire,Flying,Blaze,-----,Solar Power,-----,Monster,Dragon,78,84,78,109,85,100,534,YES,NO
,#006
@leimd
leimd / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@leimd
leimd / notes.md
Last active August 29, 2015 14:25 — forked from monicao/notes.md
Setting up your own Ruby Dev Environment on a Mac

Setting up the Ruby dev environment on Mavericks

... should work on Yosemite as well. Add a comment here if you find any problems.

Why would I want to do that?

  • You want to run guard
  • You want use Sublime plugins (like RSpec or Guard plugins)

1. Installing brew

@leimd
leimd / Testcode.rb
Created June 29, 2015 23:22
Classical inheritance
require_relative 'animals'
describe Animal do
before(:each) do
@ani = Animal.new({num_legs:4})
end
it "has four legs" do
expect(@ani.num_legs) == 4
end
@leimd
leimd / Dir_class.rb
Created June 29, 2015 19:16
File class
#Dir Class exercise
#Dir.glob returns an array of filenames
#
puts Dir.glob("../01IO/*").length
puts Dir.glob("../01IO/*.rb").join("\n")
#
#Create 500 files with extension of a,b,c,d,e#
fdir = "../01IO/Files/"
(1..500).each do |i|

Switch To Vim For Good

Non Optional

  1. Watch the Derek Wyatt videos in order (at least the “Novice” ones for now): http://derekwyatt.org/vim/tutorials/
  2. Read “The Problem with Vim”, just to warn you: http://haldean.org/vim-problems/
  3. Read the first part of this Stack Overflow answer: http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
  4. Read “How to Switch to Vim” by David Bryant Copeland (entirely): http://naildrivin5.com/blog/2013/04/24/how-to-switch-to-vim.html
  5. Read “Coming Home with Vim” by Steve Losh (entirely): http://stevelosh.com/blog/2010/09/coming-home-to-vim/
@leimd
leimd / Twp_Player_Game.rb
Last active August 29, 2015 14:23
Two Player Game
##Just some after thought, since I am using classes,I could've built all the methods into the class so that it will be easier and will be able to just call like player.verify_ans. but it is okay...
require 'colorize'
def generate_q(name)
#This one takes the string name of player and returns the answer of the problem
#Structure of q: num1, num2, operator, result
q = [rand(20).to_i,rand(20).to_i,rand(4).to_i,0]
case q[2]
@leimd
leimd / Merge Sort
Created June 24, 2015 00:43
Merge Sort
def mergsort(arr)
return arr if arr.length <= 1
#puts (0..arr.length/2-1) # Left List
#puts (arr.length/2..arr.length-1) #Right List
leftarray = arr[0..arr.length/2-1]
rightarray = arr[arr.length/2..arr.length-1]
#middle = arr[arr.length/2-1]
#arr.each {|value| value < middle ? leftarray << value : rightarray << value}