Skip to content

Instantly share code, notes, and snippets.

@cmtsij
cmtsij / GL-iNet
Created February 24, 2014 15:37 — forked from cj1324/GL-iNet
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c (revision 38494)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c (working copy)
@@ -21,7 +21,9 @@
#include "dev-wmac.h"
#include "machtypes.h"
-#define TL_WR703N_GPIO_LED_SYSTEM 27
+#define TL_WR703N_GPIO_LED_SYSTEM 13
@cmtsij
cmtsij / asus_script.js
Created May 16, 2014 09:32
asus_script.js
window.asus = window.asus || {};
asus = asus || {};
(function() {
asus.user = {
touch : "ontouchend" in document ? true : false
};
asus.url = {
the_url : document.location.href,
top_url : top.location.href
};
@cmtsij
cmtsij / car_dvr_convert.sh
Created July 9, 2014 01:14
目擊者行車記錄器 轉檔
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]
#!/usr/bin/env python3
# Author: Ali Assaf <ali.assaf.mail@gmail.com>
# Copyright: (C) 2010 Ali Assaf
# License: GNU General Public License <http://www.gnu.org/licenses/>
from itertools import product
def solve_sudoku(size, grid):
""" An efficient Sudoku solver using Algorithm X.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="lang">
<string>zh-tw</string>
</test>
<test name="family">
<string>sans-serif</string>
</test>
@cmtsij
cmtsij / Base64.md
Last active August 29, 2015 14:20 — forked from barrysteyn/Base64.md

OpenSSL Base64 Encoding: Binary Safe and Portable

Herewith is an example of encoding to and from base64 using OpenSSL's C library. Code presented here is both binary safe, and portable (i.e. it should work on any Posix compliant system e.g. FreeBSD and Linux).

License

The MIT License (MIT)

Copyright (c) 2013 Barry Steyn

@cmtsij
cmtsij / unzip_ebill_big5.py
Created September 25, 2012 02:09
unzip ebill with filenames encoded by big5.
#!/usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
import sys
import os
import zipfile
import getpass
def usage():
@cmtsij
cmtsij / unzip_ebill_big5.sh
Created September 25, 2012 02:12
unzip ebill by convmv and 7z.
#!/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 / strtoul_wrapper.c
Created September 27, 2012 10:15
wrapper of strtoul
#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 / gist:6709130
Last active December 23, 2015 23:19
目擊者行車記錄器 轉檔
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]