Skip to content

Instantly share code, notes, and snippets.

View stormslowly's full-sized avatar
🎯
Focusing

pshu stormslowly

🎯
Focusing
  • Hangzhou, Zhejiang, China
View GitHub Profile
@stormslowly
stormslowly / download_egghead_videos.md
Last active December 13, 2016 14:19 — forked from ldong/download_egghead_videos.md
download *free* egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

var links = $('h4 a').get().map(function(a){ return a.href}).join('\n')
copy(links)
@stormslowly
stormslowly / aiff2mp3.sh
Created January 8, 2016 00:27
convert to aiff to mp3
ffmpeg -i "17 Audio Track.aiff" -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 17.mp3
vcl 4.0;
acl purgers {
"localhost";
"127.0.0.1";
"192.168.199.0"/24;
}
backend default {
.host = "localhost";
@stormslowly
stormslowly / ffmpeg usage memo.txt
Last active October 27, 2016 19:37
convert a m3u8 file to mp4 file
# you should download the files in m3u8 file first
ffmpeg -i the.file.m3u8 -acodec copy -vcodec copy -y -loglevel info -bsf:a aac_adtstoasc -f mp4 your-mp4-file.mp4
# First 10 Minutes
ffmpeg -i VIDEO_SOURCE.mp4 -vcodec copy -acodec copy -ss 0 -t 00:10:00 VIDEO_PART_1.mpg
# Second 10 Minutes
ffmpeg -i VIDEO_SOURCE.mp4 -vcodec copy -acodec copy -ss 00:10:00 -t 00:20:00 VIDEO_PART_2.mpg
# Rest after the first 20 Minutes
ffmpeg -i VIDEO_SOURCE.mp4 -vcodec copy -acodec copy -ss 00:20:00 VIDEO_PART_3.mpg
@stormslowly
stormslowly / remove.js
Created June 11, 2015 08:41
remove old date by ObjectId
var day = 24*3600*1000;
var expiredTime = Date.now() - day *90;
var expiredDate = new Date(expiredTime);
var objectIdFromDate = function (date) {
var idStr = Math.floor(date.getTime() / 1000).toString(16) + "0000000000000000";
return new ObjectId(idStr);
};
db.tokens.remove({_id:{$lt:objectIdFromDate(expiredDate)}})
@stormslowly
stormslowly / inflate.js
Created May 12, 2015 01:08
git object inflate
'use strict';
var zlib = require('zlib');
var fs = require('fs');
var fileName = process.argv[2];
var buffer = fs.readFileSync(fileName);
zlib.unzip(buffer, function(_, buf) {
// console.log(buf.toString('hex'));
console.log(buf.toString());
});
@stormslowly
stormslowly / timestamp.sh
Last active August 29, 2015 14:20
add prefix time stamp for console output
someCMD | awk 'BEGIN{cmd="date +%H:%M:%S.%N"} {cmd|getline D; close(cmd); print D,$0}'
"this way slow down the cmd execute try below
someCMD | awk '{print strftime("%H:%M:%S"),$0}'
@stormslowly
stormslowly / expressV3apiextracter.js
Last active August 29, 2015 14:16
get express v3 api sublime completions array
'use strict';
var toCompelition = function(signature) {
/* app.get(name) */
var apiReg = /([a-zA-Z.]+)\(([\w\s\[\]\.\|,]*)\)/g;
var varReg = /([a-zA-Z.]+)/g;
var com = null;
var matchs = apiReg.exec(signature);
if (matchs) {
@stormslowly
stormslowly / README.md
Last active August 29, 2015 14:12
get a random commandlinefu from commandlinefu.com

STEP 0

install HTML-XML-utils and w3m

STEP 1

in your .bashrc add below alias

alias cf="curl -Ls http://www.commandlinefu.com/commands/random  |hxprune -c sample-output | hxprune -c meta|hxprune -c votes |hxprune -c options |hxprune -c window-bar  | hxnormalize  -x | hxselect -s '\n' '.terminal-display'  | w3m -dump   -T text/html"
@stormslowly
stormslowly / 微信UA.md
Created September 5, 2014 08:08
微信UA识别

iPhone 通过微信内置浏览器访问网页时得到 User Agent 是:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1

Android 通过微信内置浏览器访问网页时得到 User Agent 是:

Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255