Skip to content

Instantly share code, notes, and snippets.

@bketelsen
bketelsen / cleanup.sh
Created July 4, 2021 12:43
cleanup detritus from dev work
│ File: .zsh/includes/cleanup.sh
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ cleanup () {
2 │ find ~/src -name 'node_modules' -type d -prune -exec rm -rf '{}' +
3 │ find ~/src -name '.next' -type d -prune -exec rm -rf '{}' +
4 │ cargo sweep -r -t 30 ~/src
5 │ brew cleanup
6 │ is_bin_in_path docker && docker system prune -a -f --volumes || echo "skipping docker"
7 │ }
8 │ # https://stackoverflow.com/questions/6569478/detect-if-executable-file-is-on-users-path
@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
package main
import "fmt"
// WithPrefix
type prefixOption struct{}
func WithPrefix() interface {
GetOption
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}
-------------------------------------------------------------------
--Hammerspoon config to replace Cinch & Size-up (Microsoft Windows style) window management for free
--By Jayden Pearse (spartanatreyu)
--Sort of messy, forgive me. Never scripted in lua before
-------------------------------------------------------------------
-------------------------------------------------------------------
--Options, feel free to edit these
-------------------------------------------------------------------
@husobee
husobee / validation-main.go
Created January 8, 2016 20:07
input validation sanely
package main
import (
"encoding/json"
"errors"
"net/http"
"github.com/asaskevich/govalidator"
)
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well
@icholy
icholy / gobreak.sh
Last active December 16, 2015 19:18
Shell script to simplify setting GDB breakpoints
# Demo http://ascii.io/a/3019
# build
gdbb () {
# build with debug flags
go build -gcflags "-N -l" -o out
# make sure the build didn't fail
if [ $? != 0 ]; then return; fi
@skelterjohn
skelterjohn / gist:3743756
Created September 18, 2012 15:27
Code and example for LimitBuffer
// code for http://gowithconfidence.tumblr.com/post/31797884887/limit-buffers
package main
import (
"bytes"
"errors"
"fmt"
"io"
"sync"