Skip to content

Instantly share code, notes, and snippets.

View iwat's full-sized avatar
:octocat:
Having fun

Chaiwat S iwat

:octocat:
Having fun
  • Vancouver, BC
View GitHub Profile
@iwat
iwat / MoveTemporaryFoldersToRamdisk_MacOSX.sh
Created November 24, 2012 04:40 — forked from pklaus/AlwaysMountRootFSWithNoatime_MacOSX.sh
SSD Optimizations of Mac OS X 10.6 Operating System
#!/bin/bash
# +----------------------------------------------------------------------+
# | |
# | Set up Mac OS X to store temporary files in RAM rather than on disk.|
# | |
# | By Philipp Klaus <http://blog.philippklaus.de> |
# | |
# | Originally by Ricardo Gameiro <http://blogs.nullvision.com/?p=357> |
# | Changes by Daniel Jenkins |
@iwat
iwat / hungarian.php
Last active August 28, 2017 10:35
PHP Port of CAT_BAXTER's Python Hungarian Algorithm O(N^3). See: http://pastebin.com/tn6v0HDr
<?php
function hungarian($matrix)
{
$h = count($matrix);
$w = count($matrix[0]);
if ($h < $w)
{
for ($i = $h; $i < $w; ++$i)
{
@iwat
iwat / commit_docx.sh
Last active August 29, 2015 14:06
Commit formatted extracted docx into GIT.
#!/bin/sh
if [ "$1" != "" ] && [ "$2" != "" ]; then
FILE=$1
REPO=$1_repo
else
echo "$0 <docx file> <comment>"
exit 1
fi
#!/bin/sh
if [ "$1" != "" ]; then
FILE=$1
REPO=$1_repo
else
exit 1
fi
if [ ! -d "$REPO" ]; then
@iwat
iwat / composer.json
Last active August 29, 2015 14:27
Using Thrift with PHP and Composer
{
"autoload": {
"psr-0": {
"Thrift\\": "vendor/apache/thrift/lib/"
},
"classmap": ["gen-php"]
}
}
@iwat
iwat / profile
Last active September 7, 2016 15:20
Auto-mount non `/Users` directory on Docker Machine (docker/machine#1826)
# This Gist contains a snippet for auto-mounting non `/Users` or `/c/Users` directory on docker-machine with VirtualBox driver.
# 1. Add more shared folder on VirtualBox e.g., D:\Code -> /d/Code (and make it permanent)
# 2. Access Docker Machine SSH `docker-machine ssh`
# 3. Append the following code after original `/var/lib/boot2docker/profile` file. (as root/sudo)
# 4. `docker-machine restart`
# Note: Change the last line to match your shared folder
try_mount_share() {
dir="$1"
name="${2:-$dir}"
@iwat
iwat / docker-clean
Created June 22, 2016 02:54
Clean unused docker images and volumes.
#!/bin/sh
docker volume ls -f dangling=true -q | xargs docker volume rm
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
2016/09/09 03:00:54 [DEBUG] plugin: terraform: aws-provider (internal) 2016/09/09 03:00:54 [INFO] AWS Auth provider used: "EC2RoleProvider"
2016/09/09 03:00:54 [DEBUG] plugin: terraform: aws-provider (internal) 2016/09/09 03:00:54 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
2016/09/09 03:00:54 [DEBUG] plugin: terraform: ---[ REQUEST POST-SIGN ]-----------------------------
2016/09/09 03:00:54 [DEBUG] plugin: terraform: POST / HTTP/1.1
2016/09/09 03:00:54 [DEBUG] plugin: terraform: Host: sts.amazonaws.com
2016/09/09 03:00:54 [DEBUG] plugin: terraform: User-Agent: terraform/0.7.3 aws-sdk-go/1.4.2 (go1.7; linux; amd64)
2016/09/09 03:00:54 [DEBUG] plugin: terraform: Content-Length: 43
Error refreshing state: 5 error(s) occurred:
@iwat
iwat / fun.rb
Created April 19, 2017 04:10
Ruby shenanigans with UTF-8
# encoding: utf-8
def  (  )
  *2
end
   = 4
puts      

Keybase proof

I hereby claim:

  • I am iwat on github.
  • I am iwat (https://keybase.io/iwat) on keybase.
  • I have a public key ASCzLxkhqdm9V80rQZzYC129RuE5eYNXlm4H5X_1Pn4gwAo

To claim this, I am signing this object: