Skip to content

Instantly share code, notes, and snippets.

@spyesx
spyesx / curl-to-nextcloud.sh
Created September 14, 2020 07:52
Upload a file to Nextcloud with curl
# source: https://docs.nextcloud.com/server/19/user_manual/files/access_webdav.html#accessing-files-using-curl
curl -u USERNAME:PASSWORD -T /path/to/file https://my.nextcloud.tld/remote.php/dav/files/USERNAME/path/to/directory/
@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 November 2, 2024 08:44 — 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