Skip to content

Instantly share code, notes, and snippets.

View pacuna's full-sized avatar

Pablo Acuña pacuna

  • Spotify
  • Austin, TX
View GitHub Profile
#!/usr/bin/env bash
cd /tmp
apt-get update
export ANACONDA_LOCATION="anaconda3"
export ANACONDA_FILE="Anaconda3-5.3.1-Linux-x86_64.sh"
export ANACONDA_URL="https://repo.anaconda.com/archive/"
export ANACONDA_HOME=/usr/$ANACONDA_LOCATION
@pacuna
pacuna / rbtree.go
Last active May 11, 2020 03:54
Red-black tree implementation in Go
package rbtree
type Node struct {
Color string
Key int
Value int
Left, Right *Node
P *Node
}
@pacuna
pacuna / safari_custom.css
Last active May 29, 2020 00:27
Blocks youtube's recommended and up next
#contents.ytd-rich-grid-renderer {
display: none !important;
}
#items.ytd-watch-next-secondary-results-renderer {
display: none !important;
}
package set
type Set interface {
Add(item []byte) bool
Remove(item []byte) bool
Contains(item []byte) bool
}
package set
type Set interface {
Add(item []byte) bool
Remove(item []byte) bool
Contains(item []byte) bool
}
package simplelist
import "testing"
func Test_List(t *testing.T) {
l := New()
l.Add([]byte("item1"))
l.Add([]byte("item2"))
if l.Size() != 2 {
package main
import (
"fmt"
"sortedlist/simplelist"
"sync"
)
func main() {
l := simplelist.New()
func (l *list) Contains(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next
func (l *list) Remove(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next
func (l *list) Add(item []byte) bool {
var pred, curr *node
key, _ := hashstructure.Hash(item, nil)
pred = l.head
curr = pred.next
for curr.key < key {
pred = curr
curr = curr.next