Skip to content

Instantly share code, notes, and snippets.

Wong Liang Zan liangzan

Block or report user

Report or block liangzan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View request.xml
<?xml version="1.0" encoding="UTF-8"?>
<p:DCTRequest xmlns:p="http://www.dhl.com" xmlns:p1="http://www.dhl.com/datatypes" xmlns:p2="http://www.dhl.com/DCTRequestdatatypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com DCT-req.xsd ">
<GetQuote>
<Request>
<ServiceHeader>
<MessageTime>2002-08-20T11:28:56.000-08:00</MessageTime>
<MessageReference>1234567890123456789012345678901</MessageReference>
<SiteID>CourexPteL</SiteID>
<Password>i1td5gCzM7</Password>
</ServiceHeader>
View response.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<res:DCTResponse
xmlns:res='http://www.dhl.com'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation= 'http://www.dhl.com DCT-Response.xsd'>
<GetQuoteResponse>
<Response>
<ServiceHeader>
<MessageTime>2016-04-05T05:01:20.512+01:00</MessageTime>
<MessageReference>1234567890123456789012345678901</MessageReference>
<SiteID>CourexPteL</SiteID>
View compiler-error
toResponse :: IO (Response BL.ByteString) -> BL.ByteString
toResponse i = view responseBody i
-- compiler error
Couldn't match type ‘IO (Response BL.ByteString)’
with ‘Response BL.ByteString’
arising from a functional dependency between:
constraint ‘mtl-2.2.1:Control.Monad.Reader.Class.MonadReader
(Response BL.ByteString) ((->) (IO (Response BL.ByteString)))’
arising from a use of ‘view’
View leave_5.sh
#!/usr/bin/env bash
# leaves 5 copies of the standalone app
total_files=$(find -name '*.jar' -type f -print0 | xargs -0 ls -t | wc -l)
file_num_to_remove=`expr $total_files - 5`
find -name '*.jar' -type f -print0 | xargs -0 ls -t | tail -n $file_num_to_remove | xargs rm
View courex-xml-sample.php
<?php
/**
* Sample to use Courex XML Technical Guide
*
* How to use:
* Search for "//input" and fill in the data accordingly
*
* @author Tao Yueling <yueling@courex.com.sg>
* @copyright 2014 Courex Pte Ltd
* @version 1.0.0
View OneDrive.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Keys (oneDriveKey)
import Network.OAuth.OAuth2
import Control.Monad (liftM)
import Data.Aeson (FromJSON)
@liangzan
liangzan / fail2ban_configuration.md
Last active Jan 2, 2016
Configuration for fail2ban
View fail2ban_configuration.md

First install Fail2ban.

sudo apt-get install fail2ban

Then edit the configuration file at /etc/fail2ban/jail.conf

We are only showing the changed sections.

View error.md

Internal Server Error

The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
@liangzan
liangzan / pg_users_chef_recipe.rb
Last active Dec 15, 2015
pg_users_chef_recipe.rb
View pg_users_chef_recipe.rb
include_recipe "postgresql::server"
node[:notifymode][:db_users].each do |user|
execute "create-database-user" do
exists = <<-EOH
sudo -u postgres psql -U postgres -c "select * from pg_user where usename='#{user[:name]}'" | grep -c #{user[:name]}
EOH
command "echo \"CREATE ROLE #{user[:name]} with CREATEDB LOGIN PASSWORD '#{user[:password]}'\" | sudo -u postgres psql -U postgres"
not_if exists
end
@liangzan
liangzan / .tmux.conf
Created Oct 25, 2012
tmux configuration
View .tmux.conf
## term
set -g default-terminal "screen-256color"
set -g default-shell /bin/zsh
## tmux window titling for X
set -g set-titles on
set -g set-titles-string '#W [#S:#I]'
setw -g automatic-rename on
## msgs
You can’t perform that action at this time.