Skip to content

Instantly share code, notes, and snippets.

View kilfu0701's full-sized avatar

kilfu0701 kilfu0701

  • Trend Micro
  • Japan & Taiwan
View GitHub Profile
@kilfu0701
kilfu0701 / fetch_favicon.py
Last active August 29, 2015 14:05
Load a sqlite db file, and use `domain` to get icons.
-*- coding: utf-8 -*-
import os
import sys
import sqlite3
import urllib
import urllib2
import base64
import shutil
import time
@kilfu0701
kilfu0701 / awk
Created August 27, 2014 03:50
Some awk scripts
# number with Byte
echo 'Size 1452360394' | awk -F" " '{ split( "KB MB GB" , v ); s=1; while( $2>1024 ){ $2/=1024; s++ } print int($2) v[s] }'
# number with microsecond
echo 'Time 589566' | awk -F" " '{ split( "us ms sec" , v ); s=1; while( $2>1000 ){ $2/=1000; s++ } print int($2) v[s] }'
@kilfu0701
kilfu0701 / 1.sh
Created September 29, 2014 16:10
Install python lxml ( MacOS )
# Change path '.../MacOSX10.9.sdk/...' to where your xcode.
export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2:$C_INCLUDE_PATH
pip install lxml
@kilfu0701
kilfu0701 / my_module.js
Created September 30, 2014 02:51
nodejs console color output
'use strict';
/**
* dark=0, bright=1
* 30 .. 37
*/
var tc = {
reset: '\u001b[0m',
b_red: '\u001b[1;31m',
b_blue: '\u001b[1;34m',
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
//Database connection
var uristring = 'mongodb://localhost/test';
var mongoOptions = { };
mongoose.connect(uristring, mongoOptions, function (err, res) {
if (err) {
console.log('Error when connecting to: ' + uristring + '. ' + err);
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
find . -name "*.py" -print0 | xargs -0 perl -pi -e '$_ .= " time.sleep(10)\n" if /def logout/'

Uninstall Extension & Clear localStorage

Firefox

  • Mac:

    • localStorage
    ~/Library/Application Support/Firefox/Profiles/xxxxx.default/jetpack/myAddOn@ext
    
  • extension

'6b696c667530373031'.match(/[a-f0-9]{2}/gi).map(
function(r) {
return String.fromCharCode(parseInt(r, 16));
}
).join('');
@kilfu0701
kilfu0701 / install.sh
Created April 24, 2015 16:26
Install PyQt5 with Python2.7 on Mac
cd ~
mkdir dev_tools
cd dev_tools
## download SIP source code
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.7/sip-4.16.7.tar.gz
tar zxf sip-4.16.7.tar.gz
cd sip-4.16.7
python configure.py
make