Skip to content

Instantly share code, notes, and snippets.

Mathias Perlet mperlet

Block or report user

Report or block mperlet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mperlet
mperlet / check_iban.py
Created Apr 5, 2017
Python IBAN Checker
View check_iban.py
# Based on http://codereview.stackexchange.com/questions/135366/python-iban-validation
import string
def is_iban(unchecked_iban):
LETTERS = {ord(d): str(i) for i, d in enumerate(string.digits + string.ascii_uppercase)}
def _number_iban(iban):
@mperlet
mperlet / python_port_open.sh
Created Mar 24, 2017
python port check one line bash
View python_port_open.sh
python -c "import socket;print(True) if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('127.0.0.1',8000)) else False"
@mperlet
mperlet / change_none_unique_minidlna_title.sh
Created Aug 18, 2015
Problem: minidlna use the title from the metadata, sometimes its better when the title = the filename. This script change the title from "'HERE THE NONE UNIQUE TITLE'" to the filename.
View change_none_unique_minidlna_title.sh
for line in $(sqlite3 /root/minidlna/files.db "SELECT ID,PATH FROM DETAILS WHERE TITLE='HERE THE NONE UNIQUE TITLE';");
do
id=$(echo $line | cut -d"|" -f1);
path=$(echo $line | cut -d"|" -f2);
echo $id;
echo $path;
sqlite3 /root/minidlna/files.db "UPDATE DETAILS SET TITLE='$(basename $path)' WHERE ID=$id;";
done;
View record_mp3_and_split.sh
# record from soundcard
parec -d 1 | lame -r -V0 - my.mp3
# split file by silence
ffmpeg -i my.mp3 -af silencedetect=noise=-30dB:d=0.5 -f null - 2>&1 | grep silence_end | cut -d" " -f 5 | xargs -L 2 | nl | xargs -l bash -c 'ffmpeg -i my.mp3 -acodec copy -ss $1 -to $2 my$0.mp3'
@mperlet
mperlet / pycheck.sh
Created Jan 4, 2019
Check python files in pwd
View pycheck.sh
function pycheck() {
echo
echo
echo
find . -name "*.py" | xargs mypy --ignore-missing-imports
echo
echo
@mperlet
mperlet / imagediff.sh
Created Sep 6, 2018
Diff two images with imagemagick without saving them
View imagediff.sh
#!/bin/bash
# TODO: Add Readme
# TODO: Add Example
# TODO: Check if imagemagick is installed
IMG_A="$1"
IMG_B="$2"
convert "$IMG_A" "$IMG_B" <(compare "$IMG_A" "$IMG_B" -) +append - | display
View Abfall_LRO_iCal_Api.sh
curl 'https://www.abfall-lro.de/wp-content/themes/abfall_lro/ical.php?letters=B_K_D_P&year=2018&black=4w&green=&yellow=y&blue=y'
@mperlet
mperlet / vcy
Created Feb 11, 2018
vlc player chromecast youttube-dl
View vcy
#!/bin/bash
# v - VLC Player
# c - chromecast
# y - youttube-dl
CHROMECASTIP="192.168.178.39"
STREAMURI="$1"
CERTDIR="$HOME/.vcy"
mkdir -p "$CERTDIR"
@mperlet
mperlet / index.html
Last active Nov 18, 2017
Stadt-Land-Fluss Character Viewer
View index.html
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Stadt-Land-Fluss</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Kameron' rel='stylesheet' type='text/css'>
<!-- Bootstrap -->
@mperlet
mperlet / yt2mp3.sh
Created Aug 23, 2017
Convert Youtube-Videos or Playlists to mp3
View yt2mp3.sh
#!/bin/bash
# Example: $ yt2mp3 "https://www.youtube.com/playlist?list=PL63F1E17EE312CC7D"
function yt2mp3 () {
youtube-dl -i -t --extract-audio --audio-format mp3 "$1"
}
You can’t perform that action at this time.