Skip to content

Instantly share code, notes, and snippets.

View aboettger's full-sized avatar

Andreas Böttger aboettger

View GitHub Profile
@aboettger
aboettger / mirrorownership
Last active April 23, 2016 13:22
mirror ownership of a file
sudo find . -not -path "./minidlna*" -path -print0 | xargs -0 -i'{}' sudo chown --reference={} /media/pi/Pi/{}
@aboettger
aboettger / ubuntu-next
Created September 10, 2015 09:31
Start an Ubuntu release via ISO and grub2
menuentry "ubuntu-next" {
set isofile="/ubuntu/wily-desktop-amd64.iso"
loopback loop (hd0,4)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile nouveau.modeset=0
initrd (loop)/casper/initrd.lz
}
@aboettger
aboettger / originInstalledPackages
Created September 8, 2015 10:46
get origin of an installed packages
LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' \
| fgrep ':install ok installed' \
| cut -d: -f1 \
| (while read pkg; do
inst_version=$(apt-cache policy $pkg \
| fgrep Installed: \
| awk '{ print $2 }');
origin=$(apt-cache policy "$pkg" \
| fgrep " *** ${inst_version}" -C1 \
| tail -n 1 \
@aboettger
aboettger / adjust_width_active_window
Created January 10, 2015 17:28
changes window width (75%)
#!/bin/bash
#screenWidth=$(xdpyinfo | grep dimensions | grep -o '[0-9]*' | head -n1)
#width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//')
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//')
xdotool getactivewindow windowsize 75% "$height"
exit 0
@aboettger
aboettger / center_active_window
Created January 10, 2015 11:51
center active window
#!/bin/bash
IFS='x' read screenWidth screenHeight < <(xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1)
width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//')
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//')
newPosX=$((screenWidth/2-width/2))
newPosY=$((screenHeight/2-height/2))
xdotool getactivewindow windowmove "$newPosX" "$newPosY"
@aboettger
aboettger / findbetween
Created January 9, 2015 10:27
find files between specific times
find . -newermt "2015-01-08 17:00:00" ! -newermt "2015-01-08 19:00:00"
@aboettger
aboettger / gist:6a86df1e2ffa09addbe2
Last active August 29, 2015 14:03
Lokomotivbaureihen im PDF finden
pdftotext "input.pdf" - | sed -e "s/\x{00A0}/ /g" | tr '\n' ' ' | sed -e "s/[[:space:]]\{2,\}/ /g" | grep -oaP "(die|Baureihe|VT|VB|E|V|BR|DB)[[:space:]]*[0-9]{2,3}[[:space:]]*[0-9]*" | sed -e "s/^ *//" | sed -e "s/ *$//" | sed -e "s/^Baureihe/BR/" | sed -e "s/^die/BR/" | sort -b | uniq | tr '\n' ','
@aboettger
aboettger / remove-no-break-space
Created July 1, 2014 17:41
Replace NO-BREAK SPACE with Space
pdftotext test.pdf test.txt; sed -i 's/\xA0/ /g' test.txt
@aboettger
aboettger / add info pdf
Created June 15, 2014 16:18
add info to a pdf
exiftool -overwrite_original -Author="Autorengruppe – Modelleisenbahner" Modelleisenbahner\ -\ Autorengruppe\ -\ Modelleisenbahner\ \(Kopie\).pdf
pdftk Modelleisenbahner\ -\ Autorengruppe\ -\ Modelleisenbahner\ \(Kopie\).pdf dump_data | awk '/InfoKey: Title/{getline; print}'