Skip to content

Instantly share code, notes, and snippets.

@spyesx
spyesx / 1.get-volume-names.md
Last active August 25, 2020 12:27
Mount all docker volumes in an Alpine container for inspection. I use this on macOS since docker volumes are not directly accessible.

Get all volumes' names

$ docker volume ls | awk '{print $2}' | grep -v 'VOLUME'
> 0d8ffd800baf623b030e727829f6a31dd05a0ed73877021f018a849be0ce6433
> 0dc6353456b723b4885f556fb49938b497bdea4bf792bca12d7b5c6ef12dcf16
> 2a579e3e73596349308a4ece576f00c6822f1a04481965f6b8ed366b771dd5ea
@spyesx
spyesx / semantic-commit-messages.md
Last active August 29, 2020 16:29 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@spyesx
spyesx / detox_rename_filenames.sh
Created February 4, 2020 04:22
Clean up and lowercase filenames
# https://explainshell.com/explain?cmd=detox+-s+iso8859_1+-r+-v+.%2F*
detox -s iso8859_1 -r -v ./*
# Lowecase filenames
# linux
rename 'y/A-Z/a-z/' *
# macOS needs to be forced
@spyesx
spyesx / optimize_pdf_size.sh
Created January 24, 2020 04:20
Optimize PDF size by changing it's density
# https://explainshell.com/explain?cmd=convert+-density+200x200+-quality+60+-compress+jpeg+input.pdf+output.pdf
convert -density 200x200 -quality 60 -compress jpeg input.pdf output.pdf
apiVersion: v1
data:
auth: <SECRET>
kind: Secret
metadata:
name: staging-basic-auth
type: Opaque
@spyesx
spyesx / 5G-vote.js
Last active November 27, 2019 16:10
5G Vote
var cleanStorage = function(){
console.log('%c Start clean localStorage', 'color: green')
var myStorage = window.localStorage;
var ids = Object.keys(myStorage).filter( (key) => {
return key.slice(0,3) === '5G_'
})
ids.forEach( (id) => {
console.log('clean: '+id)
window.localStorage.removeItem(id);
})
@spyesx
spyesx / console-save.js
Created November 1, 2019 04:47
A simple way to save objects as .json files from the console, includes a chrome extension along with a plain script.
// Source : http://bgrins.github.io/devtools-snippets
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
@spyesx
spyesx / kubectl-cheat-sheet.md
Last active October 29, 2019 09:16
kubectl cheat sheet

Add a kubectl context

# copy cluster's certificate to a file
vi cluster-certificate.txt

# Set cluster
kubectl config set-cluster <CLUSTER_NAME> --server=https://37.187.1.138:6443 --certificate-authority=cluster-certificate.txt --embed-certs=true

# Set credentials
@spyesx
spyesx / docker-cheat-sheet.md
Last active February 15, 2024 10:04 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Stop all containers

$ docker stop $(docker ps -q)

Build docker image

$ cd /path/to/Dockerfile
@spyesx
spyesx / find_hidden_files.sh
Created October 14, 2019 12:37
Find and delete all files starting by ._ but in directories @eadir. Command needed on an encrypted volume on DSM (Synology)
find . -type f -name '._*' ! -path '*@eaDir*' -exec rm -f "{}" \;
# Find and delete all files starting by ._ but in directories @eaDir. Command needed on an encrypted volume on DSM (Synology)
# https://explainshell.com/explain?cmd=find+.+-type+f+-name+%27._*%27+%21+-path+%27*%40eaDir*%27+-exec+rm+-f+%22%7B%7D%22+%5C%3B