Skip to content

Instantly share code, notes, and snippets.

View huettern's full-sized avatar

Noah Huetter huettern

View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
import os, sys
import pathlib
from pathlib import Path
from tqdm import tqdm
from scipy.io import wavfile
import tensorflow as tf

Delete local branches that were delete on remote

git remote prune origin
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d

Unstage a file

git reset HEAD 
@huettern
huettern / renew_ssl_synology.md
Last active December 29, 2021 11:43
Wildcard certificate on Synology NAS

Use certbot to create a wildcard certificat with DNS challenge

DOMAIN="example.com"
sudo certbot certonly  --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory -d "*.$DOMAIN"

Follow the instructions on the console and create the DNS TXT record.

Copy the generated files to a working directory

alias gst='git status '
alias gad='git add '
alias gbr='git branch '
alias gco='git commit '
alias gdi='git diff '
alias gch='git checkout '
alias gpu='git push '
alias glg="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
alias gpg2syno='/usr/local/gnupg/bin/gpg2'
# List keys
gpg2syno --list-keys
# Export private key
KEY_ID=12345678
gpg2syno -a --export-secret-keys $KEY_ID > secret-gpg.key
# Export public key
#!/bin/bash
# GPG Key to use for data encryption
KEY_ID=3387FFED
# Host
HOST=`cat /var/services/homes/outpost/outpost_ip.txt`
USER=pi
# Check for input arguments
if [ $# -ne 2 ]
#!/bin/bash
# GPG Key to use for data encryption
KEY_ID=3387FFED
# Host
HOST=`cat /var/services/homes/outpost/outpost_ip.txt`
USER=pi
if [ $# -ne 2 ]
#/bin/bash
# Outside port to be openned for incomming ssh connections
PORT=12322
# Host Name and Port of the announce destination using SSH
HOST=host.com
HOST_PORT=22
curl -s http://whatismyip.akamai.com/ | ssh outpost@$HOST -p$HOST_PORT "cat > ~/outpost_ip.txt; echo ":$PORT" >> ~/outpost_ip.txt"
# Make sure port is forwarded
#!/bin/bash
# GitLab Backup script
# Backup config
docker exec -t gitlab /bin/sh -c 'umask 0077; tar cfz /var/opt/gitlab/backups/$(date "+etc-gitlab-config-%s.tgz") -C / etc/gitlab'
# Backup data
sudo docker exec -t gitlab gitlab-rake gitlab:backup:create
# Delete old config
sudo find /srv/gitlab/data/backups/ -type f -name 'etc-gitlab-*' -mtime +30 -exec rm {} \;
# Copy to backup server
sudo rsync -rvz --delete "/srv/gitlab/data/backups" "/media/beeblebroxgitlab/backup"
@huettern
huettern / ocbackup.sh
Created September 19, 2017 18:41
ownCloud Backup script
#!/bin/bash
# Author: noah huetter - dlatch.com
#
# v2:
# - added database backup
# - partial file transfer for no big file junk on /tmp
# v3:
# - Variables for user settings
# - Comments and functions