Skip to content

Instantly share code, notes, and snippets.

View albertlieyingadrian's full-sized avatar
🤠

Albert Lie 이영덕 albertlieyingadrian

🤠
View GitHub Profile
@albertlieyingadrian
albertlieyingadrian / remove_github_branches.sh
Created June 23, 2018 08:41
[GIT] Remove local github project branches except master
git branch | grep -v "master" | xargs git branch -D
@albertlieyingadrian
albertlieyingadrian / clean_kubernetes_pods.sh
Created August 4, 2018 12:08
Remove all pods in kubernetes cluster
kubectl get pods --all-namespaces -o json | jq -r '.items[] | select(.metadata.name | contains("your_pods_tag"))' > pods.json && kubectl delete -f pods.json
@albertlieyingadrian
albertlieyingadrian / clean_docker_images.sh
Created August 6, 2018 08:58
Clean docker images with specific keywords
docker rmi -f $(docker images | grep KEYWORD | awk "{print \$3}")
@albertlieyingadrian
albertlieyingadrian / clean_exited_docker_container.sh
Created August 6, 2018 09:02
Clean exited docker container
docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
@albertlieyingadrian
albertlieyingadrian / clean_untagged_docker_images.sh
Last active May 25, 2019 05:08
Clean untagged docker images
docker rmi $(docker images -a | grep "^<none>" | awk "{print $3}")
@albertlieyingadrian
albertlieyingadrian / clone_repos_in_organization.sh
Last active March 12, 2019 11:51
Clone all repos in an organization using ssh url
curl -s https://$USERNAME:[email protected]/orgs/$ORGANIZATION/repos?per_page=200&page=1 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
@albertlieyingadrian
albertlieyingadrian / remove_node_modules.sh
Created July 13, 2019 10:48
Remove node_modules recursively
find . -name "node_modules" -exec rm -rf '{}' +
@albertlieyingadrian
albertlieyingadrian / accounting.sql
Created July 19, 2019 06:35 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
wget -r -np -k https://www.facebook.com