Skip to content

Instantly share code, notes, and snippets.

View raypereda's full-sized avatar

Ray Pereda raypereda

  • Genesis Research Group
  • Long Beach, CA
View GitHub Profile
@raypereda
raypereda / The Technical Interview Cheat Sheet.md
Created February 16, 2016 00:27 — forked from deepmehtait/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@raypereda
raypereda / sum.rb
Created August 7, 2014 18:41
ruby sum columns of a text file (better than awk)
cat temp.txt | ruby -nae 'BEGIN { x = 0 }; puts "#{ x += $F[0].to_f }"'

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@raypereda
raypereda / gist:28540f3c9285046fb1d1
Created June 6, 2014 23:46
number of commits for each person in the last 48 hours
git shortlog -s -n --after "48 hours ago"
package main
import (
"net/http"
"fmt"
)
func main() {
http.Handle("/string", String("I'm a frayed knot."))
http.Handle("/struct", &Struct{"Hello", ":", "Gophers!"})
package main
import (
"fmt"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
return fmt.Sprintf("cannot Sqrt negative number: %g ", float64(e))
package main
import "fmt"
func Cbrt(x complex128) complex128 {
z := x
for i := 0; i < 10; i++ {
z = z - (z*z*z - x)/ (3*z*z)
}
return z
@raypereda
raypereda / fibo.go
Created April 2, 2014 05:01
fibonacci in go
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func(int) int {
return func(n int) int {
a, b := 0, 1
for i := 0; i < n; i++ {
@raypereda
raypereda / array_practice.go
Created April 2, 2014 04:35
practice using arrays in go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
for i, _ := range pic {
pic[i] = make([]uint8, dx)
for j := 0; j < dy; j++ {
pic[i][j] = uint8(i*j)
@raypereda
raypereda / word_count.go
Created April 2, 2014 04:08
count the words in a string
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
"fmt"
)
func WordCount(s string) map[string]int {
words := strings.Fields(s)