Skip to content

Instantly share code, notes, and snippets.

@thiamteck
thiamteck / LogViewer.py
Created November 15, 2017 02:20
A more readable view for capture file of Selenium SMPPSim
import datetime
import fileinput
import shlex
##
# Usage: tail -f *.capture | python LogViewer.py
##
def construct_dictionary(line):
# ref: https://stackoverflow.com/a/38787616/90101
@thiamteck
thiamteck / remove_namespace_from_xml.sh
Created April 6, 2017 03:06
Remove default namespace declaration from pom.xml
#
# Reference : http://stackoverflow.com/a/16700113/90101
#
#
# remove default namespace declaration
#
sed -e 's/ xmlns=".*"//g' pom.xml
#
@thiamteck
thiamteck / 0_reuse_code.js
Created January 5, 2016 04:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
==== initialDP ====
{
"header": {
"clgt": "60121234567"
"otid": "123456778",
"cdgt": "60121234567"
"dtid": "123456778",
"app-ctx": "123456778",
"tc-type": 62(begin)/65(continue)/64(end)
},
@thiamteck
thiamteck / guan-yin.js
Created October 29, 2015 11:17
guan yin
// /$$
// |__/
// /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$ /$$ /$$ /$$$$$$$
// /$$__ $$| $$ | $$ |____ $$| $$__ $$ | $$ | $$| $$| $$__ $$
// | $$ \ $$| $$ | $$ /$$$$$$$| $$ \ $$ | $$ | $$| $$| $$ \ $$
// | $$ | $$| $$ | $$ /$$__ $$| $$ | $$ | $$ | $$| $$| $$ | $$
// | $$$$$$$| $$$$$$/| $$$$$$$| $$ | $$ | $$$$$$$| $$| $$ | $$
// \____ $$ \______/ \_______/|__/ |__/ \____ $$|__/|__/ |__/
// /$$ \ $$ /$$ | $$
// | $$$$$$/ | $$$$$$/
@thiamteck
thiamteck / index.js
Created October 29, 2015 11:11 — forked from edokeh/index.js
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@thiamteck
thiamteck / gist:e343066680b04a550606
Created April 29, 2015 04:27
One liner for extract public SSL cert from a server
openssl s_client -connect 127.0.0.1:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt
@thiamteck
thiamteck / Axis2Attachement.java
Last active December 24, 2015 17:39
Set content type, encoding of attachment when using Axis2 to send SOAP request
//
// import these:
//
// import org.apache.axiom.attachments.Attachments;
// import org.apache.axiom.attachments.ConfigurableDataHandler;
// import javax.activation.FileDataSource
Attachments attachments = new Attachments();
ConfigurableDataHandler dh = new ConfigurableDataHandler(new FileDataSource("testing.gif")); // file path
@thiamteck
thiamteck / gist:4624687
Created January 24, 2013 16:37
Format and Mount USB Flash Drive on Raspberry Pi
sudo mke2fs -t ext3 /dev/sda1
sudo mount -t ext3 /dev/sda1 /media/usbflash/
@thiamteck
thiamteck / gist:2918567
Created June 12, 2012 16:33
Configuration Fragment for Axis2 + Rampart
<parameter name="OutflowSecurity">
<action>
<items>UsernameToken Timestamp</items>
<user>bob</user>
<passwordCallbackClass>org.apache.rampart.samples.sample03.PWCBHandler</passwordCallbackClass>
<passwordType>PasswordText</passwordType>
<addUTElements>Nonce Created</addUTElements>
</action>
</parameter>