Skip to content

Instantly share code, notes, and snippets.

redis-cli --raw keys "$PATTERN" | xargs redis-cli del
@willm
willm / gist:64dba1ffe7d60db4f5637d306b8e2b82
Created July 15, 2020 07:29
Take a back up of a mysql db
mysqldump --user=drupal --password=''--host='' --opt 'DB_NAME' > database.sql
@willm
willm / linux.md
Last active June 11, 2020 07:28
Linux cheat sheet

Users

Set home directory

usermod -m -d $path $user

Add to group

usermod -aG $group $user

Network

Which dns servers am I using

@willm
willm / ip addresses.sh
Created May 8, 2020 04:32
parse just the ip addresses from ifconfig
ifconfig | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
@willm
willm / cmus.md
Last active June 26, 2019 06:21
Cmus cheat sheet

File view 5

a - add file/folder

Library view 2

c - play / pause

v - stop

@willm
willm / clean.sh
Created January 28, 2019 21:36
Reclaim docker disk space mac os
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*
@willm
willm / dynamo cheet sheet.sh
Last active April 12, 2018 23:45
dynamo cheat sheet
#count of items
aws dynamodb scan --table-name baskets --select COUNT
#item by key
aws dynamodb get-item --table-name baskets --key '{"Id":{"S": "195eaf9c-50e6-4524-81e0-22403e46b6df"}}'
@willm
willm / postgres_cheat.md
Created January 23, 2018 10:28
Postgres cheat sheet

Kill all sessions for a db

select pg_terminate_backend(pid)
from pg_stat_activity
where datname = 'doomed_database'
@willm
willm / format.vim
Created January 3, 2018 10:37
vim format current buffer in json
:%!python -m json.tool
@willm
willm / time.sh
Created September 5, 2017 13:15
time request curl
curl -s -w "%{time_total}\n" -o /dev/null http://www.google.com/