Skip to content

Instantly share code, notes, and snippets.

@ankion
ankion / ffmpeg-wrapper
Created March 2, 2020 03:21 — forked from BenjaminPoncet/ffmpeg-wrapper
Synology VideoStation ffmpeg wrapper with DTS, EAC3 and TrueHD support (Installation instructions in 1st comment)
#!/bin/bash
rev="12"
_log(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}
_log_para(){
echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - = &/" >> /tmp/ffmpeg.log

I forget where I found this, so if anyone wants to claim attribution, let me know and I'll add a line here. If put into /etc/profile.d/serial-console.sh, the following will auto size a serial terminal windows size and create a function for manually adjusting later. Since I access RPIs and BBBs via the serial console, their tty names are already listed in the case statement; add others if your system is different. rsz helps when you later reconnect and minicom or screen is in a different sized window...

    rsz() {
        if [[ -t 0 && $# -eq 0 ]];then
                local IFS='[;' escape geometry x y
                echo -ne '\e7\e[r\e[999;999H\e[6n\e8'
                read -sd R escape geometry
                x=${geometry##*;} y=${geometry%%;*}
                if [[ ${COLUMNS} -eq ${x} && ${LINES} -eq ${y} ]];then

echo "${TERM} ${x}x${y}"

@ankion
ankion / Gulpfile.js
Created October 21, 2015 06:39 — forked from Hendrixer/Gulpfile.js
Gulpfile with Livereload, Nodemon, and other features
var gulp = require('gulp'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
server = require('tiny-lr')(),
refresh = require('gulp-livereload'),
mocha = require('gulp-mocha'),
stylus = require('gulp-stylus'),
notify = require('gulp-notify'),
nodemon = require('gulp-nodemon'),
jshint = require('gulp-jshint'),
@ankion
ankion / color-thief-example.js
Created October 16, 2015 07:42
color-thief example
var img = new Image();
img.onload = function () {
var colorThief = new ColorThief();
var color = colorThief.getPalette(img, 8, 5)
console.log('color:' + color);
};
img.crossOrigin = 'Anonymous';
img.src = src;
@ankion
ankion / gist:fb152542d887391c9b6d
Last active August 29, 2015 14:24
Qnap install flexget
#Upgrade
/opt/local/bin/pip2.7 install --upgrade flexget
#IOError: [Errno 28] No space left on device
mount -o remount,size=64M /tmp
#!/bin/bash
# install xcode command tool
xcode-select --install
# check
xcode-select -p
# install brew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# check brew
@ankion
ankion / AutoPasteMode.vim
Created December 16, 2014 01:53
Auto Paste Mode
if &term =~ "xterm.*"
let &t_ti = &t_ti . "\e[?2004h"
let &t_te = "\e[?2004l" . &t_te
function XTermPasteBegin(ret)
set pastetoggle=<Esc>[201~
set paste
return a:ret
endfunction
map <expr> <Esc>[200~ XTermPasteBegin("i")
imap <expr> <Esc>[200~ XTermPasteBegin("")
@ankion
ankion / gist:a4f4a0c8b1942e202017
Last active August 29, 2015 14:03
mysql notes
$ mysql -u adminusername -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5340 to server version: 3.23.54
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)
@ankion
ankion / sources.list
Created July 10, 2014 02:28
Ubuntu 12.04 LTS Sources list
#
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release i386 (20120424.1)]/ precise main restricted
#deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release i386 (20120424.1)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://tw.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise main restricted
@ankion
ankion / debian_basic_command.md
Created June 20, 2014 06:41
Debian basic command

修改預設的編輯器

sudo update-alternatives --config editor