Skip to content

Instantly share code, notes, and snippets.

View BrianLeishman's full-sized avatar
🐢

Brian Leishman BrianLeishman

🐢
  • Stumpyinc
  • Orlando
View GitHub Profile
@fsmv
fsmv / pass.go
Last active October 9, 2022 21:15
A runnable go script that creates an http basic auth password hash compatible with .htaccess (this is just the password part, you have to add username:<hash>)
/*?sr/bin/env go run "$0" "$@"; exit $? #*/
// This is actually not a shebang, the first line is both valid shell script and valid go code
// Just run: chmod +x pass.go; ./pass.go
package main
import (
"bufio"
"crypto/sha256"
"encoding/base64"
"fmt"
@dimasch
dimasch / redis-clear
Last active March 26, 2024 13:56
Clear a redis cache in Docker
docker exec -it container-name redis-cli FLUSHALL
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;