Skip to content

Instantly share code, notes, and snippets.

View jhelgert's full-sized avatar
🏠
Working from home

Jonathan Helgert jhelgert

🏠
Working from home
View GitHub Profile
@jhelgert
jhelgert / duration.sh
Last active August 29, 2015 14:26
Simple script to calculate the duration between two hh:mm:ss:ms timesteps.
#!/bin/bash
#
# Description: Simple script to calculate the duration between two ffmpeg-timesteps. May be helpful for cutting.
#
# Contact: imgnow.de
#
# Feel free to share it or modify it for your needs.
# usage: ./duration.sh timestep1 timestep2
# example: ./duration.sh 00:02:43.540 01:21:11.780
@jhelgert
jhelgert / flac_to_mp3.sh
Last active February 4, 2016 16:14
Converts all .flac files to .mp3 (v0) and keeps the metadata
#!/bin/bash
IFS=$'\n'
for i in $(ls *.flac);
do ffmpeg -i "$i" -codec:a libmp3lame -q:a 0 -map_metadata 0 -id3v2_version 3 "${i%.flac}".mp3
done
unset IFS
@jhelgert
jhelgert / osx_mounting.scpt
Last active March 31, 2016 07:45
Simple applescript for mounting shares on osx automatically on boot. Checks for the connected network and then mounts the specific shares.
set mylocalip to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
if mylocalip = "Fritzbox" or mylocalip = "Fritzbox_5ghz" then
set isbautzonline to do shell script "if ping -c 1 -t 1 -W 250 bautz &> /dev/null; then echo 1; else echo 0; fi"
if isbautzonline = "1" then
tell application "Finder"
mount volume "afp://Bautz/RAID" as user name "jonathan"
mount volume "afp://Bautz/jonhel.de" as user name "jonathan"
mount volume "afp://Bautz/Blog" as user name "jonathan"
end tell
end if
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{compat = newest}
\pgfplotstableread{data.dat}
\datatable
#!/bin/bash
for i in $(ls *.mkv); do
mkdir $( echo $i | sed 's/.mkv/g')
mv $( echo $i | sed 's/.mkv/g')/
done
<!DOCTYPE html>
<html>
<body>
<!-- see: http://stackoverflow.com/a/23733994/4745529 !-->
<a href="#">
<img src="http://www.geekchamp.com/upload/symbolicons/animals/1f424-chicken.png"
onmouseover="this.src='http://www.geekchamp.com/upload/symbolicons/animals/1f423-chick.png'"
onmouseout="this.src='http://www.geekchamp.com/upload/symbolicons/animals/1f424-chicken.png'"
border="0" alt=""/></a>
</body>
@jhelgert
jhelgert / cutting.sh
Last active January 31, 2016 18:40
simple script for cutting with ffmpeg
#!/bin/bash
#
# Description:
# +++++++++++++
# This script automatically calculates the duration of the timeframes we want to keep,
# cut's out these parts with ffmpeg before they'll be merged at the end.
# Requieres duration.sh and ffmpeg.
#
# Feel free to share or modify it for your needs.
#
#!/bin/bash
# cd to icloud directory
cd ~/Library/'Mobile Documents'/com~apple~CloudDocs/Uni/5.*/
# Defining the variables
ALGURL="http://www.math.uni-mannheim.de/~pfboech/algebra/alg.html"
OPTIURL="http://scicom.math.uni-mannheim.de/de/teaching/hws-2016/optimierung-lecture-tutorials/"
KRYPTOURL="http://hilbert.math.uni-mannheim.de/~seiler/Krypto16/"
@jhelgert
jhelgert / birthday.r
Created March 10, 2016 22:52
Simulating 1000 times: How many times are there at least two same birthdays in a group of x people?
# defining x
x <- 23
flag <- 1:1000
for (i in 1:1000) {flag[i] <- (length(unique(sample(365,x, replace=TRUE))) != x) }
sum(flag)
@jhelgert
jhelgert / birthday.sci
Last active March 10, 2016 23:29
Simulating 1000 times: How many times are there at least two same birthdays in a group of n people?
// Mindestens zwei Gleiche Geburtstage (ohne Beachtung des Jahres)
// aus einer Gruppe von n Personen.
n = 23; // n Personen
t=zeros(1,1000);
T=zeros(1,10);
for j=1:10
for i=1:1000
if length(unique(sample(n,1:365))) < n
t(i)=1;