Skip to content

Instantly share code, notes, and snippets.

@hslu-dig
hslu-dig / s.js
Created October 7, 2019 09:16
#kubectl #volume #delete
kubectl get pv | tail -n+2 | awk '{print $1}' | xargs -I{} kubectl patch pv {} -p '{"metadata":{"finalizers": null}}'
@hslu-dig
hslu-dig / aa.sh
Last active September 27, 2019 09:33
#git #submodule update (specify specific branch)
# specify branch = #branch-name in .gitmodules
git submodule update --init --recursive --remote
@hslu-dig
hslu-dig / pandoc.sh
Created July 6, 2019 07:20
pandoc #shell
pandoc -s --css=../github.css --self-contained --to=html5 --mathml *.md -o test.htm
@hslu-dig
hslu-dig / tmux.sh
Last active July 11, 2019 09:54
tmux #session
tmux ls
tmux new -s myname
tmux attach -t #name
ctrl + b -> d
@hslu-dig
hslu-dig / check ports
Created April 5, 2019 16:19
check ports
sudo netstat -tnlp | grep 8080
@hslu-dig
hslu-dig / shell.js
Created April 5, 2019 11:09
mount nfs nas
mkdir -p /var/nfs/digarchive
mount nas01.el.eee.intern:/data/shares/digarchive /var/nfs/digarchive/
@hslu-dig
hslu-dig / git.sh
Created March 18, 2019 16:20
clear history (with remote) #git #remote
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@hslu-dig
hslu-dig / snippet.js
Created December 10, 2018 09:14
#mongodb #shell find and drop duplicates
db.getCollection('strings').aggregate([
{
$group:
{
_id: { projectId: "$string_data" },
dups: { $addToSet: "$_id" },
count: { $sum:1 }
}
},
{
@hslu-dig
hslu-dig / snippets.js
Created December 10, 2018 09:05
#mongodb #query find duplicates by field
db.getCollection('strings').aggregate([
{$group: {
_id: {CERT: "$string_data"},
uniqueIds: {$addToSet: "$_id"},
count: {$sum: 1}
}
},
{$match: {
count: {"$gt": 1}
}
@hslu-dig
hslu-dig / docker.sh
Created October 19, 2018 09:48
run docker
docker run -d -p 8888:80 <NAME>