Skip to content

Instantly share code, notes, and snippets.

@asserchiu
asserchiu / logcat-threadtime_to_csv.c
Created March 2, 2011 04:38
convert threadtime format logcat into csv file
#include <stdio.h>
#include <stdlib.h>
int main(int argv, char *argc[])
{
if (argv!=2)
{
printf("Usage: %s \"threadtime_format_logcat_file\"\n",__FILE__);
exit(-1);
}
/**
* documentLocationSearch2Dic
* --------------------------
*
* Convert `document.location.search` string into key-values
*
* @param {String} documentLocationSearch document.location.search
* @return {Object} key-values of search strings
*/
@asserchiu
asserchiu / README.md
Last active January 1, 2016 05:39
Python datetime / time conversions.
@asserchiu
asserchiu / gist:8121275
Last active January 1, 2016 08:49
UNIX date time format conversion using `sed`.
$ cat dm.test
25/12/2013,20:00:00,asdf,qwer,zxcv
$ sed -n -e "s_\(..\)/\(..\)/\(....\),_\3-\2-\1T_p" dm.test
2013-12-25T20:00:00,asdf,qwer,zxcv
$ date --universal --rfc-3339 ns|sed -ne "s_^\(....-..-..\)\ \(..:..:..\....\).*_\1T\2Z_p"
2013-11-15T19:39:42.146Z
$ alias date.toISOString='date --universal --rfc-3339 ns|sed -ne "s_^\(....-..-..\)\ \(..:..:..\....\).*_\1T\2Z_p"'
$ date.toISOString
@asserchiu
asserchiu / gist:10273352
Last active August 29, 2015 13:58
JavaScript `for ... in ... xxx.hasOwnProperty`
var a = {
'0': 3,
'3': 5,
'10': 8
};
function fn(dics, num) {
var resp = null;
var keys = Object.keys(dics);
console.log("----------");
@asserchiu
asserchiu / Preferences.sublime-settings
Last active October 23, 2016 09:05
Sublime Text Preference
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"fold_buttons": true,
"folder_exclude_patterns":
@asserchiu
asserchiu / README.md
Last active August 29, 2015 14:04
Online regular expression editor and tester
@asserchiu
asserchiu / gist:817bf66ccf209e24d0fe
Last active September 9, 2018 07:27
C pointers.
char *x; // x: a pointer to char
char x[3]; // x: an array[3] of char
char x(); // x: a function() returning char
char *x[3]; // x: an array[3] of pointer to char
char (*x)[3]; // x: a pointer to array[3] of char
char **x; // x: a pointer to pointer to char
char *x(); // x: a function() returning pointer to char
char *x()[3]; // x: a function() returning array[3] of pointer to char
char (*x[])(); // x: an array[] of pointer to function() returning char
char (*x())(); // x: a function() returning pointer to function() returning char