Skip to content

Instantly share code, notes, and snippets.

@smartest
smartest / watch.sh
Last active August 29, 2015 14:03 — forked from mikesmullin/watch.sh
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <[email protected]>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@smartest
smartest / gist:4ed33f0b221ca21e8d29
Last active August 29, 2015 14:03
Using NanumGothic in R
NanumGothic <- CIDFont('NanumGothic', 'KSCms-UHC-H', 'CP949', '
/FontDescriptor
<<
/Type /FontDescriptor
/CapHeight 737
/Ascent 752
/Descent -271
/StemV 58
/FontBBox [-199 -145 1903 880]
/ItalicAngle 0
@smartest
smartest / m3u
Created January 26, 2016 11:33
Extract Playlist from Plex Server Linux to m3u
#!/bin/bash
#echo "#EXTM3U"
#sqlite3 /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "select file from media_parts left outer join media_items on media_items.id = media_parts.media_item_id left outer join play_queue_generators on play_queue_generators.metadata_item_id = media_items.metadata_item_id left outer join metadata_items on metadata_items.id = play_queue_generators.playlist_id where play_queue_generators.playlist_id='9567'"
WorkDir="`dirname $0`"
PlaylistDir="/mnt/Playlists"
TheLastLog="${PlaylistDir}/plexlog.inf"
plexdb="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
@smartest
smartest / cuetoiTunes
Created January 26, 2016 11:36
bin/cue file to iTunes alac auto import
#!/bin/bash
if [ ! -f "$1.cue" ]; then
echo "Argument '$1' is not a file.";
exit 1;
fi
dirtoremove="${1%/*}"
if [[ $(find flacs -type f | wc -l) -gt 0 ]]; then
@smartest
smartest / flacstoalacs.ps1
Created January 26, 2016 11:38
flacs to alacs with folder structure (powershell, ffmpeg)
xcopy flacs alacs /tecsy
ls -recurse -path flacs -include *.flac | %{.\ffmpeg\bin\ffmpeg.exe -i $_.FullName -acodec alac ("alacs"+$_.DirectoryName.Substring(((resolve-path $pwd).providerPath).length+6)+"\"+$_.BaseName+'.m4a')}
@smartest
smartest / extaud
Created January 26, 2016 11:40
Audio extract from Video with intended interval (avconv)
#!/bin/bash
#read -r filename < $1
exec < $1
read filename
#echo "$filename"
while read s e
do
echo "${s} - ${e}"
@smartest
smartest / hbripepisodes
Created February 10, 2016 14:17
DVD Ripping only large title sizes with HandBrakeCLI
#!/bin/bash
lsdvd . |sed -n 's/^Title\:\ \([[:digit:]]*\),\ Length\:\ \([[:digit:]]*\)\:\([[:digit:]]*\)\:.*/\1 \2 \3/p'|awk '$2*60+$3 >= 30 && $2*60+$3 < 50 {print "Title:" $1 " - " $2 " hr " $3 " mins"}'
title=($(lsdvd $1 |sed -n 's/^Title\:\ \([[:digit:]]*\),\ Length\:\ \([[:digit:]]*\)\:\([[:digit:]]*\)\:.*/\1 \2 \3/p'|awk '$2*60+$3 >= 30 && $2*60+$3 < 50 {print $1}'))
for i in "${title[@]}"
do
echo "Title: $i"
done
read -p "Titles listed above may be the appropriate episodes. Press [Enter] to start encoding."