Skip to content

Instantly share code, notes, and snippets.

@zdebra
zdebra / main.go
Created April 15, 2023 08:36
Trie implementation in go
package main
import "fmt"
type node struct {
children map[rune]*node
value rune
}
func newNode(v rune) *node {
@zdebra
zdebra / init.vim
Created February 20, 2022 18:25
nvim setup
syntax on
set cursorline " Highlight the currently selected line
set hlsearch " highligh search results
set expandtab " expand <Tab>s with spaces; death to tabs!
set ruler " show current position at bottom
set number " Show line numbers
set ignorecase " Enable case insenstive search
set showmatch " show matching brackets
set autoindent " set the cursor at same indent as line above
set smartindent " try to be smart about indenting (C-style)
@zdebra
zdebra / throttled_transport.go
Created June 15, 2021 14:48
NewThrottledTransport wraps transportWrap with a rate limitter, improvement of https://gist.github.com/MelchiSalins/27c11566184116ec1629a0726e0f9af5 since it allows use of *http.Client
package main
import (
"net/http"
"time"
"golang.org/x/time/rate"
)
// ThrottledTransport Rate Limited HTTP Client
@zdebra
zdebra / Dockerfile
Created June 27, 2017 08:37
CircleCI build image
FROM node:8.1.2
# Update the system
RUN apt-get -y update && apt-get -y install build-essential chrpath libssl-dev libxft-dev netcat unzip jq python-pip libpython-dev
# installing aws-cli
RUN pip install awscli
# frontend build dependencies
RUN npm install -g [email protected] --unsafe-perm
@zdebra
zdebra / example.java
Last active December 11, 2016 20:40
neo4j java
Result r4 = db.execute("MATCH (l:lorry)-->(d:delivery) OPTIONAL MATCH (d)-->(f:food {name:'avocado'}) RETURN l.driver AS driver, f.count as count");
while (r4.hasNext()) {
Map<String, Object> row = r4.next();
System.out.println("driver: "+row.get("driver") + ", avocados: " + row.get("count"));
}