Skip to content

Instantly share code, notes, and snippets.

View hazcod's full-sized avatar

Niels Hofmans hazcod

View GitHub Profile
@hazcod
hazcod / downloadFile
Created May 19, 2015 08:05
Download latest files from moonlight repo
#!/bin/bash
function downloadFile {
releases=`curl -s -L https://github.com/irtimmer/moonlight-embedded/releases/latest`
echo "$releases" | egrep -o "/irtimmer/moonlight-embedded/releases/download/v([0-9]\.*)+/$1" | wget --base=http://github.com/ -i - -O "$1"
}
downloadFile libopus.so
downloadFile limelight.jar
@hazcod
hazcod / updateMoonlight.sh
Created May 19, 2015 08:56
Update Moonlight
function version { echo "$@" | gawk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; }
function downloadFile {
echo "$1" | egrep -o "/irtimmer/moonlight-embedded/releases/download/v([0-9]\.*)+/$2" | wget -q --base=http://github.com/ -i - -O "$2"
}
function updateMoonlight {
FILE=version
releases=`curl -s -L https://github.com/irtimmer/moonlight-embedded/releases/latest`
current_version=`cat $FILE`
@hazcod
hazcod / gist:a27d2879c3fdce134651
Created June 2, 2015 20:24
How to monitor CPU temperature on xbian
sudo modprobe bcm2835-thermal
/opt/vc/bin/vcgencmd measure_temp
@hazcod
hazcod / downloadWebsite
Created July 20, 2015 16:26
How to download a website
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains website.org \
--no-parent \
www.website.org/foobar/
@hazcod
hazcod / setup_media_vps.sh
Last active September 23, 2015 13:33
Hardening configuration for apache2/httpd with webdav server
address="vps.tv"
sudo apt-get install -y apache2
sudo mkdir /var/log/httpd
sudo a2enmod headers
sudo a2enmod dav
sudo a2enmod dav_fs
sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2enmod auth_digest
@hazcod
hazcod / subs-library.sh
Last active October 16, 2015 08:12
Downloads dutch subtitles for my library on a encfs mount with uploader.sh and subliminal.
#!/bin/bash
for moviepath in /tmp/media/movies/*; do
movie=$(basename "$moviepath")
echo $movie
mkdir "/home/media/data/uploadme/movies/$movie"
filename=$(echo "$movie" | cut -d "(" -f 1 | sed -e 's/^ *//g;s/ *$//g')
touch "/home/media/data/uploadme/movies/$movie/${filename}.mp4"
/usr/local/bin/subliminal download -f -d "/home/media/data/uploadme/movies/$movie/" "/home/media/data/uploadme/movies/$movie/" -l nl
rm "/home/media/data/uploadme/movies/$movie/${filename}.mp4"
@hazcod
hazcod / tcopy.sh
Last active October 22, 2015 05:18
Small script to tar and send over SSH for large compressed files. Rsync is too slow.
#!/bin/sh
IN_DIR=/volume1/Media/Films
OUT_DIR=/mnt/media/movies
REMOTE=nindustries@149.210.164.73
if [ ! -z "$1" ]; then
IN_DIR="$1"
fi
if [ ! -z "$2" ]; then
@hazcod
hazcod / __init__.py
Last active November 16, 2015 18:15
Post-process file for CouchPotato (custom_plugins/__init__.py)
from os import system, path, makedirs
import sys
def autoload():
move_to="/home/media/data/uploadme/movies/"
arr=sys.argv[2].split('/')
moviename=arr[6]
if not path.exists(move_to + moviename):
makedirs(move_to + moviename)
@hazcod
hazcod / pp_sickrage.sh
Last active January 27, 2016 15:00
Post-process file for sickrage
#!/bin/bash
#set -e
#set -x
move_to="/home/nindustries/data/acd/series"
inputpath="$1"
IFS='/'; read -ra ARR <<< "$inputpath"
@hazcod
hazcod / git-bare-pull.sh
Created October 13, 2016 08:04
Pull changes from remote to a bare git repo.
#!/usr/bin/env bash
#set -e
#set -x
# directory where your git repos reside
repo_dir="/home/hazcod/repos/"
# the repos in repo_dir that should be pulled from remote (origin)
repos=(myproject)