Skip to content

Instantly share code, notes, and snippets.

View mheland's full-sized avatar

Magnus mheland

View GitHub Profile
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
# Ghost on port 2368
proxy_pass http://127.0.0.1:2368;
# Multiple replacements
YouTube IFRAME embed for faster page loads in privacy enhanced mode
https://magnushelander.se/youtube-no-cookies-embed-privacy/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Native Instruments :: Traktor Audio 2 ALSA Configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Device Channels Ports
# ------ -------- -----
# TraktorAudio2ChannelA 2 12xx
# TraktorAudio2ChannelA 2 xx34
#
# TraktorAudio2ChannelAB 4 1234
@mheland
mheland / clip-to-dokuwiki.sh
Last active April 13, 2019 11:34
Translate HTML in clipboard to DokuWiki markup
#!/bin/bash
# Pipe clipboard to pandoc and pipe the DokuWiki markup back to clipboard
xclip -o -selection clipboard | pandoc -f html -t dokuwiki | xclip -selection clipboard
# Display first five non-blank lines from clipboard cut to one hundred characters in the confirmation dialog
result=$(xclip -o -selection clipboard | tr -s '\n' '\n' | head -n 5 | cut -c -100 )
# Info box with preview of clipboard contents
zenity --info --title="HTML to Dokuwiki markup" --text="Clipboard preview: \n\n $result" --width=300 --height=100
@mheland
mheland / webimage.desktop
Last active January 28, 2019 09:22
Enabling right-click send-to from Thunar file manager
# Save this file to ~/.local/share/Thunar/sendto/
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
TryExec=webimage.sh
Exec=webimage.sh %F
Icon=dialog-information
Name=Web image optimizer
MimeType=image/jpeg;image/png;
@mheland
mheland / webimage.sh
Last active January 28, 2019 12:29
Shell script to optimize PNG and JPEG from XFCE - Thunar
#!/bin/bash
for f in $@ #can be list of files
do
imagename=$(echo "$f" | cut -f 1 -d '.')
imagetype=$(echo "$f" | cut -f 2 -d '.')
outfile=$imagename"-web."$imagetype
if [ "$imagetype" = "png" ]
then #it's a PNG
gm convert $f -resize 1200 -enhance +profile "*" $outfile