Skip to content

Instantly share code, notes, and snippets.

@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 / README.md
Last active January 1, 2016 05:39
Python datetime / time conversions.
/**
* documentLocationSearch2Dic
* --------------------------
*
* Convert `document.location.search` string into key-values
*
* @param {String} documentLocationSearch document.location.search
* @return {Object} key-values of search strings
*/
@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);
}