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
@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 / turing-machine-simple-simulator.rb
Created March 2, 2018 20:09
Turing machine simple simulator
# Turing machine simulator - Inspired by Kill All Software screencast
# Guide to symbols:
# B: Blank. All the values of the tape are initally Blank
# L: Left. For the pointer to move Left
# R: Right. For the pointer to move right
# s{n}: State number {n}, ex. s1, s2, s3
def simulate(instructions)
# Initial state of the tape
@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 / 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
# 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]
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++)
{