Skip to content

Instantly share code, notes, and snippets.

View DavidPesticcio's full-sized avatar
🚀
¯\_(ツ)_/¯

David Pesticcio DavidPesticcio

🚀
¯\_(ツ)_/¯
View GitHub Profile
@DavidPesticcio
DavidPesticcio / docker-registry-delete-image.txt
Created June 28, 2018 20:47
remove images from docker registry v2.4
How to delete an image tag/image from docker registry v2.4
1) Re/Start registry with delete option enabled
Edit the config.yml
storage:
delete:
enabled: true
@DavidPesticcio
DavidPesticcio / udemy-course-reset-for-browser.md
Last active January 8, 2024 18:56
Udemy: Reset a course, i.e. uncheck all boxes

Un/check all visible checkboxes for a course.

Currently only works if course content is visible, and course section(s) is/are already expanded.

Usage:

Open console for web browser (F12 or Right-Click Inspect) Paste the section of JavaScript below into the console according to your needs.

Open Course Content (WIP)

@DavidPesticcio
DavidPesticcio / Encrypted ZFS root install on Linux Mint 20.x & Ubuntu 20.04
Created February 22, 2021 14:13
Encrypted ZFS root install on Linux Mint 20.x & Ubuntu 20.04
### Steps for an encrypted ZFS root installation on Linux Mint 20.x & Ubuntu 20.04
01. Boot from an Ubuntu based installer/Live CD - Linux Mint 20.x or Ubuntu Desktop 20.04
02. Open a terminal
03. Run: `sudo apt -y install zfs-zed` - **!IMPORTANT!** - Ensure the ZFS pre-requisites installed!
04. Run: `sudo vi /usr/share/ubiquity/zsys-setup`
- find the right section with `/^init_zfs`
- prepend the `zpool create` for `rpool` with `echo MYPASSWORD | ` - `MYPASSWORD` **MUST** be 8 characters or more!
eg. `echo MYPASSWORD | zpool create -f \` - **DO NOT FORGET THIS!**
05. Above the last line of the `zpool create` command, insert these lines:
@DavidPesticcio
DavidPesticcio / syncthing-automerge.py
Created August 26, 2023 20:43 — forked from solarkraft/syncthing-automerge.py
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
@DavidPesticcio
DavidPesticcio / get_jenkins_credentials.groovy
Created November 26, 2019 18:15
Jenkins: How to decrypt credentials
// Here is a short snippet you can just run from the jenkins script console, to dump all of your credentials to plain text.
com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{
it.properties.each { prop, val ->
println(prop + ' = "' + val + '"')
}
println("-----------------------")
}
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@DavidPesticcio
DavidPesticcio / setup-users.groovy
Created May 14, 2023 10:39 — forked from johnbuhay/setup-users.groovy
jenkins init.groovy.d script for configuring users
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
To add a GPG Public key
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 1AD28806
@DavidPesticcio
DavidPesticcio / vsc-settings.py
Created February 6, 2023 11:42 — forked from wonderbeyond/vsc-settings.py
script to export vsc settings
#!/usr/bin/env python3
from os import path
import tempfile
import subprocess
import datetime as dt
import click
@click.group()
def cli():
@DavidPesticcio
DavidPesticcio / gpg-hints-and-tips.txt
Created January 12, 2023 16:38
GPG Hints and Tips
Export a key to GPG or ASCII format
gpg --export YOUR_FINGERPRINT > pubkey.gpg
gpg --armor --export YOUR_FINGERPRINT > pubkey.asc
Convert a key/file to/from GPG or ASCII format
gpg --enarmor file.gpg > file.asc
gpg --dearmor file.asc > file.gpg