Skip to content

Instantly share code, notes, and snippets.

@sfwn
sfwn / ossmigration.sh
Last active March 10, 2017 15:30
a simple shell script using ossutil for migrating datas between two buckets which you can access but not yours
# ossutl download addr: http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/50452/intl_zh/1488523315888/ossutil
# -c specify oss config file
# `/root/.ossold` is for source bucket, `/root/.osspaas` is for dest bucket
ossutil cp oss://paas oss -r -u -j 20 -c /root/.ossold
ossutil cp oss oss://terminus-paas/ -r -u --snapshot-path /root/snapshot-path -j 20 --parallel 3 -c /root/.osspaas
@sfwn
sfwn / 0 gc-step.md
Last active June 7, 2023 13:06
docker registry cleanup script : just reserve most recently 5 images per repo

you need jq first.

Steps:

  1. download the script && chmod +x
  2. enable "delete" inside docker registry container
/etc/docker/registry/config.yml

storage:
 delete:
@sfwn
sfwn / local-linguist.sh
Created May 24, 2018 05:43 — forked from PuZZleDucK/local-linguist.sh
Script to wrap the `linguist` command so it can be used on non-repositories
echo "Local Linguist (linguist for non repos)"
if git status 2> /dev/null > /dev/null; then
echo "!!! This directory is already a git repository... please use the 'linguist' command instead"
echo "!!! If this command exits unclean it will leave a git repository behind"
echo "!!! You can remove the git repository by running 'rm -Rf .git'"
else
git init 2> /dev/null > /dev/null
git add --all 2> /dev/null > /dev/null
git commit -m "local linguist auto commit" 2> /dev/null > /dev/null
linguist "$@"