Skip to content

Instantly share code, notes, and snippets.

View harsh183's full-sized avatar
😺
People pleasing users

Harsh Deep harsh183

😺
People pleasing users
View GitHub Profile
import java.util.Random;
public class GameShow
{
public static void main()
{
Random r= new Random();
int stayResult=0;
int switchResult=0;
for(int x=0;x<100000;x++)
{
# Basic implementation of the monty hall problem based on
# http://mathforum.org/dr.math/faq/faq.monty.hall.html
#
# Harsh Deep
# 18.7.2016
# This is a acceptable door configuration, :goat means that there is a goat
# behind and :car means that there is a car behind.
doors = [:goat, :car, :goat]
@harsh183
harsh183 / hacker.rb
Created October 21, 2016 15:57
Movie level backer bs
require 'faker'
puts "Exit via Control-C (it's safe)"
puts "Best run with green text and black background (Mac terminal: Homebrew)"
# Messages per second
# Takes the speed from the command line arguement, if not given takes 50
if ARGV[0].nil?
puts "No given speed so taking 50 messages a second"
puts
@harsh183
harsh183 / numbersToWords.rb
Last active November 5, 2017 11:03
To convert number to words in ruby (for any positive integer)
def toWords(num)
units = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']
tens = ['', '', 'Twenty', 'Thirty', 'Fourty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
teens = ['Ten', 'Eleven', 'Tweleve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen',
'Seventeen', 'Eighteen', 'Nineteen']
units_digit = num % 10
tens_digit = num / 10
number_in_words = ""
@harsh183
harsh183 / guide.md
Created November 5, 2018 08:24
A noob's guide to fast.ai on VectorDash

VectorDash guide for Fasth AI (for Noobs, by Noobs, of Noobs)

Last updated: 2018-11-4

Okay I saw this on reddit a while back here

It's like digital ocean but GPU, neat and really simple to setup. My notes on this and some bash scripts I guess.

I'm a bit salty there is no persistent storage, but the net is fast so I think I can work around that.

Setup

@harsh183
harsh183 / uiuc-google-login.rb
Created January 15, 2019 02:44
This script uses selenium to login into uiuc's google apps login.
require 'watir'
require 'webdrivers'
@browser = Watir::Browser.new :firefox
# Standard google apps login page
@browser.goto("https://accounts.google.com/signin/v2/identifier?hl=en&passive=true&continue=https%3A%2F%2Fwww.google.com%2F&flowName=GlifWebSignIn&flowEntry=ServiceLogin")
# First pass google (google is weird, my input field selectors weren't )
@browser.send_keys "hdeep2@illinois.edu" # Can be anything that exists
<!DOCTYPE html><html lang="C"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"><meta name="apple-mobile-web-app-capable" content="yes"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:type" content="website"><meta name="twitter:card" content="summary"><style>@media screen{body,html{background:#000;height:100%;margin:0;overflow:hidden}[data-bespoke-marp-fragment=inactive]{visibility:hidden}.bespoke-marp-osc{display:none;opacity:0}.bespoke-marp-parent{bottom:0;left:0;position:absolute;right:0;top:0}.bespoke-marp-parent>.bespoke-marp-osc{background:rgba(0,0,0,.65);border-radius:7px;bottom:50px;color:#fff;display:block;font-family:Helvetica,Arial,sans-serif;font-size:16px;left:50%;line-height:0;opacity:1;padding:12px;position:absolute;touch-action:manipulation;-webkit-transform:translateX(-50%);transform:translateX(-50%);transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-
#!/bin/bash
# This script is my standard create a new experiment for my new idea/side project/whatever that I normally seem to do. I can change this if I like as I move along.
set -e # Fail if one step fails
set -x # Print before execute
cd ~/Experiments/
mkdir $1
cd $1
#!/bin/bash
# This script is my standard create a new experiment for my new idea/side project/whatever that I normally seem to do. I can change this if I like as I move along.
set -ex
mkdir ~/Experiments/$1
cd ~/Experiments/$1
echo "# README" > README.md
@harsh183
harsh183 / index.md
Last active June 16, 2019 10:10
Find the only x, y, z positive integers such that x^3 = (z-y)^3 + 3yz(z-y) Presentation at: https://sleepy-noyce-8b3d2a.netlify.com/#1
theme marp
uncover
true

Find the only $x$, $y$, and $z$ positive integers

$$ x^3 = (z - y)^3 + 3yz(z - y)