Skip to content

Instantly share code, notes, and snippets.

View masonwan's full-sized avatar

Mason Wan masonwan

View GitHub Profile
@masonwan
masonwan / DbBenchmark.md
Created November 18, 2013 04:48
DbBenchmark.md

Screenshot

Output

Search all books which the title starts with "Survival".
========================================
Use normal query
28.2 ms
Use stored procedure
@masonwan
masonwan / printAllColors.sh
Last active December 25, 2015 09:19
Print all possible combinations of bash colors, according to [Advanced Bash-Scripting Guide](http://www.tldp.org/LDP/abs/html/colorizing.html)
#! /bin/bash
for isBold in {0..1}; do
for background in {40..47}; do
for foreground in {30..37}; do
colorTag='\e['$isBold';'$foreground';'$background'm'
colorResetTag='\e[0m'
text=$colorTag'isBold:'$isBold' foreground:'$foreground' background:'$background$colorResetTag
echo -e $text
done
@masonwan
masonwan / Shutdown-MySQL.ps1
Last active December 23, 2015 19:19
PowerShell script for running stuffs on Windows
# From <http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx>
function Get-ScriptDirectory {
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$dir = Get-ScriptDirectory
$cmd = $dir + '\bin\mysqladmin.exe'
& $cmd -u root shutdown