Skip to content

Instantly share code, notes, and snippets.

@cmtsij
cmtsij / gist:6709130
Last active Dec 23, 2015
目擊者行車記錄器 轉檔
View gist:6709130
sudo add-apt-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get install ffmpeg
# start/end and crop
ffmpeg -ss [start_second] -t [period] -i [input.file] -c:a copy -filter:v "crop=640:240:0:0" [output.file]
# use -an to remove audio stream
ffmpeg -ss [start_second] -t [period] -i [input.file] -an -c:a copy -filter:v "crop=640:240:0:0" [output.file]
@cmtsij
cmtsij / google.xml
Last active Jul 11, 2019
Custom "Google Map" source for Mobile Atlas Creator 1.9.8
View google.xml
<!--
custom "Google Map" source for Mobile Atlas Creator 1.9.8
save in *.xml and move to /mapsources
-->
<customMapSource>
<name>Google Map</name>
<minZoom>0</minZoom>
<maxZoom>20</maxZoom>
<tileType>PNG</tileType>
@cmtsij
cmtsij / strtoul_wrapper.c
Created Sep 27, 2012
wrapper of strtoul
View strtoul_wrapper.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>
unsigned long int strtoul_wrapper(const char *nptr, char **endptr, int base,int *ret_errno)
{
int set_error = 1;
@cmtsij
cmtsij / unzip_ebill_big5.sh
Created Sep 25, 2012
unzip ebill by convmv and 7z.
View unzip_ebill_big5.sh
#!/bin/sh
file=$1
path=${file%%.zip}
mkdir -p $path
LANG=en_US.BIG-5 7z e -y -o"$path" "$file" 2>/dev/null
(cd "$path" && convmv -f BIG5 -t UTF-8 --notest --replace * )
@cmtsij
cmtsij / unzip_ebill_big5.py
Created Sep 25, 2012
unzip ebill with filenames encoded by big5.
View unzip_ebill_big5.py
#!/usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
import sys
import os
import zipfile
import getpass
def usage():