Skip to content

Instantly share code, notes, and snippets.


Shusse Kaido shussekaido

View GitHub Profile
View ffmpeg-throttle.txt
brew install cpulimit
Run ffmpeg with:
nice -19 cpulimit -l 30 -- ffmpeg blah blah -threads 1 /tmp/yourvideo.mp4
Note that '-threads 1' needs to be the last option.
shussekaido / polling.js
Created Jan 9, 2017
Use Promise to wait until polled condition is satisfied
View polling.js
function ensureFooIsSet() {
return new Promise(function (resolve, reject) {
(function waitForFoo(){
if ( return resolve();
setTimeout(waitForFoo, 30);
shussekaido / koohiistroke.js
Created Nov 1, 2014
Adds kanji stroke order to the Study and Review sections of Works with Tampermonkey or Greasemonkey for Chrome or Firefox.
View koohiistroke.js
// ==UserScript==
// @name Kanji.koohii Stroke Order
// @namespace koohiistroke
// @description Adds kanji stroke order to the study and review sections on
// @include*
// @include*
// @include*
// @include*
// @grant GM_xmlhttpRequest
// @version 1.1
shussekaido / Koohii Review stroke order
Created Feb 23, 2014
Adds Kanji Stroke Order to the Review section of Tested in Chrome with Tampermonkey.
View Koohii Review stroke order
// ==UserScript==
// @name Kanji.koohii Stroke Order - Review section
// @namespace koohiireview
// @description Adds Kanjis Stroke Order to the Review section
// @include*
// @include*
// @version 1.0
// ==/UserScript==
shussekaido / Remove timecodes from SRT
Created Sep 30, 2013
Creates plain text from SRT files by removing timecodes
View Remove timecodes from SRT
To simply remove timecodes (this is a long command that should be on one line):
|cat "$@"|tr -d '\r'
|grep -v '^[0-9]*$'
|grep -v '^[0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9][0-9][0-9] --> [0-9]'
> episode01.txt
To remove timecodes and linebreaks:
shussekaido / gist:ddd94060539ef90f7eaf
Last active Jan 9, 2017
Confluence 5 on FreeBSD 9 with OpenJDK 7
View gist:ddd94060539ef90f7eaf
# 
# 
# On brand new FreeBSD do:
portsnap fetch extract
# Otherwise do:
portsnap fetch update
View our_setup_script.js
db = db.getSisterDB("config");
var mongosConn = db; // assume we connected to a mongos to get going
var res = null;
function check() {
if( !res || !res.ok ) {
throw "check(): not ok, stopping";
View m101_hw_2.2.js
// Assign your query to a variable. To quote the assignment: "select homework documents, sort by student and then by score"
var students = db.grades./* YOUR CODE */
// Create a variable to track student_id so we can detect when it changes
var id = "";
// Loop through our query results. Each document in the query is passed into a function as 'student'
students.forEach(function (student) {
if (id !== student.student_id) { // Check if the student_id is new
db.grades./* YOUR CODE */ // If your 'students' query is correct the document with the lowest homework score is here. Remove it.
You can’t perform that action at this time.