Skip to content

Instantly share code, notes, and snippets.

View aarti's full-sized avatar
🎯
Focusing

aarti

🎯
Focusing
  • San Francisco Bay Area
View GitHub Profile
set nocompatible " be iMproved, required
" #set backspace=indent,eol,start
filetype off " required
nnoremap <BS> X
set backspace=indent,eol,start
set nu
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
@aarti
aarti / tmuxinator-kafka
Created March 14, 2017 10:38
Start Kafka locally
# ~/.tmuxinator/kafka.yml
name: kafka
root: ~/dev/confluent/confluent-3.2.0
attach: false
windows:
- zookeeper: './bin/zookeeper-server-start ./etc/kafka/zookeeper.properties'
- server:
- sleep 3
- './bin/kafka-server-start ./etc/kafka/server.properties'
@aarti
aarti / make_gifs.go
Created January 6, 2017 02:29
Convert Gif's to PingPong Gif's
package main
import (
"bytes"
"image"
"image/gif"
"io/ioutil"
"log"
"net/http"
"sort"
@aarti
aarti / web-crawler.go
Last active December 31, 2016 07:47
Golang Tour Exercise: parallelize a web crawler. This implementation is using an html parser to scan href's.
package main
import (
"fmt"
"log"
"net/http"
"golang.org/x/net/html"
)
/*
Design a Rate Printer
The printer reads from a file
The printer writes to a file
Print the Bytes/Second at which the printer is printing every second
*/
package main
import (
"fmt"
def deserialize(input)
h = {}
l = 0
stack = []
curr_string = ""
while l < input.length do
case input[l]
when "{" #state = DICT_START
curr_string = ""
when ":" #state = VALUE_START
@aarti
aarti / connect_four.go
Created September 19, 2016 00:51
connect 4 in Go
package main
import (
"fmt"
"math/rand"
"os"
"regexp"
"strconv"
"strings"
)
@aarti
aarti / print array or slice
Created September 5, 2016 03:45
go generic print cannot print array
gore> a:=[]int{1,2,3}
[]int{1, 2, 3}
gore> println(a)
[3/3]0xc420041f20
gore> b:=[3]int{1,2,3}
[3/3]0xc420041ef8
[3]int{1, 2, 3}
gore> println(b)
# command-line-arguments
/var/folders/r0/xqky0mq5773d6bc44pk_xfb00000gp/T/705406632/gore_session.go:10: illegal types for operand: print
package main
import (
"fmt"
"image"
"image/color"
"image/gif"
"image/jpeg"
"image/png"
"math/rand"
@aarti
aarti / sorting_array_concepts.rb
Created January 23, 2014 16:34
Sort or Sort_by could do the same thing since they both take a block
a =[{n: 1}, {n: 5}, {n: 3}]
a.sort {|x,y| x[:n]<=>y[:n] } #=> [{:n=>1}, {:n=>3}, {:n=>5}]
a.sort_by{|x| x[:n].to_i } #=> [{:n=>1}, {:n=>3}, {:n=>5}]