Skip to content

Instantly share code, notes, and snippets.

View tndoan's full-sized avatar
🏠
Working from home

Doan Thanh Nam tndoan

🏠
Working from home
View GitHub Profile
# convert from webm to mp3
ffmpeg -i input.webm output.mp3
# split mp3 file to several audio files whose length is 3600s and the names of these files begin with out<id>.mp3
ffmpeg -i out.mp3 -f segment -segment_time 3600 -c copy out%03d.mp3
@tndoan
tndoan / Moviepy.py
Last active April 9, 2017 12:05
MoviePy example
from moviepy.editor import *
import moviepy.video.fx.all as vfx
clip = VideoFileClip('fname.mp4')
mclip = clip.fx(vfx.mirror_x) # all frame in clip will be mirrored in x-axis
mclip.write_videofile('mirror_fname.mp4')
##################################################
clip = VideoFileClip('fname.mp4')
@tndoan
tndoan / 4sq_category_tree.txt
Last active November 9, 2022 15:35
All category tree of Foursquare. Count the number of space in the begining of string to indicate the level of category.
Arts & Entertainment
Aquarium
Arcade
Art Gallery
Bowling Alley
Casino
Circus
Comedy Club
Concert Hall
Country Dance Club
@tndoan
tndoan / sent_example.py
Created January 2, 2014 03:05
It is the example of using Python to request the result from Sentiment 140. This example is based on http://help.sentiment140.com/api
import urllib2
import json
s = '{"data": [{"text": "I love Titanic."},{"text": "I hate Titanic."}]}' # 2 short text that we want to do sentiment analysis
response = urllib2.urlopen('http://www.sentiment140.com/api/bulkClassifyJson', s) # request to server
page = response.read() # get the response
print page # print the result
@tndoan
tndoan / memusg
Created November 29, 2013 06:52 — forked from netj/memusg
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
set -um
# check input
[ $# -gt 0 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }