Skip to content

Instantly share code, notes, and snippets.

@patientzero
patientzero / awslogin.sh
Created October 25, 2017 16:17
Login to aws eu-central-1
DOCKER_LOGIN=`aws ecr get-login --region eu-central-1`
${DOCKER_LOGIN}
@patientzero
patientzero / migrate_vscode.sh
Last active March 6, 2019 17:37
Migrate vscode extensions to new machine
#!/bin/bash
# Install all vscode extensions on another machine
# based on https://stackoverflow.com/questions/35773299/how-can-you-export-vs-code-extension-list
# paste this in your terminal window on the base machine, it creates an sh file to execute on your new machine
echo '#!/bin/bash' > install_vscode_extensions.sh
code --list-extensions | xargs -L 1 echo code --install-extension >> install_vscode_extensions.sh
@patientzero
patientzero / backup_hist.sh
Last active January 3, 2023 09:52
regular backup of bash_history
#!/bin/bash
# This is a script to backup your command history.
# How to use:
# 1.) create dir (mkdir ~/history) and place this script as backup_hist.sh in it.
# 2.) add daily cronjob
# to run daily at midnight, add this line to the crontab(crontab -e):
# 0 0 * * * /bin/bash ~/history/backup_hist.sh > /dev/null 2>&1
# 3.) To allow filtering of commands by date, add this to your .bashrc:
# HISTTIMEFORMAT="%d/%m/%y %T " and also here:
# hist command in non interactive shells by defautl disabled, so enable by adding historyfile
@patientzero
patientzero / spectrograms.py
Last active November 22, 2018 13:04
Spectrograms
from scipy.io.wavfile import read,write
from pylab import plot,show,subplot,specgram
import pylab as pl
# Simple versions:
rate, data = read('wiederholung.wav')
_=specgram(data, NFFT=256, Fs=rate, noverlap=0,cmap='inferno',scale_by_freq=False) # small window
# Custom functions:
# Source : http://qaru.site/questions/804495/cutting-of-unused-frequencies-in-specgram-matplotlib
@patientzero
patientzero / jira_letsencrypt.md
Created January 19, 2019 09:20 — forked from dborin/jira_letsencrypt.md
HOWTO Configure Atlassian Jira to use Letsencrypt certificate

HOWTO Configure Atlassian Jira to use Letsencrypt certificate with default Tomcat

This is a primer for installing a Letsencrypt certificate on a Jira server that is running the Jira provided, default Tomcat for serving webpages.

I found lots of information about how to do it using a free-standing Tomcat or nginx, but nothing about this particular combination. I hope it helps you!

Obviously, in all the examples, you need to replace jira.example.com with your own domain! And (duh) you need to use your own password, not 1234

You need to have installed Java (outside the scope of this document). Then in your user's shell RC file and probably root's RC file, add

### Keybase proof
I hereby claim:
* I am patientzero on github.
* I am sebastianbayerl (https://keybase.io/sebastianbayerl) on keybase.
* I have a public key ASBAzeywZrXnBpjPs4rL5teZKmxbF8f7LP8G-xJHUr5WZQo
To claim this, I am signing this object:
@patientzero
patientzero / cloudSettings
Last active December 21, 2020 11:42
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-21T11:42:03.823Z","extensionVersion":"v3.4.3"}
@patientzero
patientzero / ffmpeg.md
Created August 27, 2019 08:33 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@patientzero
patientzero / group_k_fold_example.py
Created October 10, 2019 14:48
Example for the usage of sklearn GroupKFold
from sklearn.model_selection import GroupKFold
# define number of splits
n_splits = 10
# all data in a list
pics = list(data_dir.glob('**/*.png'))
# matching labels in list
labels = [pic.parent.stem for pic in pics]
# get all groups that should not be in the
groups = [pic.stem.split('_')[1] for pic in pics]
gkf = GroupKFold(n_splits=n_splits)
@patientzero
patientzero / uninstall_vscode.sh
Created April 8, 2020 09:58
Uninstall Visual Studio Code from Mac
#!/bin/bash
# based on Medium Blogpost :https://medium.com/@jimkang/complete-uninstall-remove-vscode-mac-5e48bef3bdec
rm -rf $HOME/Library/Application\ Support/Code
rm -rf $HOME/.vscode
rm -rf /Applications/Visual\ Studio\ Code.app