Skip to content

Instantly share code, notes, and snippets.

View mutoo's full-sized avatar

Lingjia Liu mutoo

View GitHub Profile
@mutoo
mutoo / a-closed-uniform-bspline-curve.markdown
Last active July 16, 2019 23:47
A closed uniform BSpline curve
@mutoo
mutoo / bundle.css
Created August 21, 2018 11:00
svg path
.container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center
}
.caption{width:640px;padding:20px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#efefef;font-family:'Source Code Pro', Menlo, Consolas, Monaco, monospace
}
.grid{pointer-events:none
}
.handle{cursor:pointer;fill:white
}
#------------------------------------------------------------------------------
# Entry
#------------------------------------------------------------------------------
main -> _ level6 _
{% ([ ,value, ]) => value %}
#------------------------------------------------------------------------------
# Helpers
@mutoo
mutoo / hipchat-message-bot
Last active April 24, 2018 07:50
send message by script in hipchat.
var messages = ['★', '☆']
var inputEl = document.querySelector('#hc-message-input');
var inputEvent = document.createEvent("Events");
inputEvent.initEvent("input", true, true);
var enterEvent = document.createEvent("Events");
enterEvent.initEvent("keydown", true, true);
enterEvent.which = 13;
enterEvent.keyCode = 13;
@mutoo
mutoo / imagemagick.md
Created April 24, 2017 15:20
fix the orientation of images
convert -auto-orient /path/to/images
@mutoo
mutoo / wav2mp3.sh
Last active March 6, 2017 11:07
wav2mp3
#!/bin/bash
process() {
dir=$@
echo "processing $dir/"
FILES=$@/*
IFS=$(echo -en "\n\b")
for file in $FILES; do
if [ -f "$file" ]; then
@mutoo
mutoo / isChinese.lua
Created May 27, 2016 11:27
check given utf8 character was Chinese or not.
function isChinese(s, ci)
local lower = { 228, 184, 128 } -- 0x4E00
local middl = { 224, 128, 128 }
local upper = { 233, 190, 165 } -- 0x9FA5
for i, v in ipairs(lower) do
local c = s[ci + i - 1]
if c < v then
return false
elseif c > v then
break
@mutoo
mutoo / volume2db.lua
Created April 8, 2016 01:49
将音量转化为 db
function this.Volume2DB(vol)
vol = math.max(math.epsilon, vol)
return 20 * math.log(vol, 10)
end
@mutoo
mutoo / course.js
Last active March 6, 2017 11:09
a simple topological sorting program to solve course ordering.
var path = require("path");
var args = process.argv.slice(2);
var inputFile = args[0] || "sample.json";
var courseData = require(path.resolve(inputFile));
var Node = function(name) {
this.name = name;
this.inDegrees = 0;
this.afterEdges = [];
}
@mutoo
mutoo / jhead.md
Last active April 24, 2017 15:21
modify jpg create time
$ jhead -ta+h:mm file.jpg