Skip to content

Instantly share code, notes, and snippets.

View kinwahlai's full-sized avatar

KinWah Lai kinwahlai

  • Odd-e Singapore
  • Singapore
View GitHub Profile
@kinwahlai
kinwahlai / stashExporter
Created July 28, 2020 14:06 — forked from VersionMismatch/stashExporter
Export git stashes to patch files using the stash name as the file name
git stash list| sed 's/\//\_/g'|sed 's/ /\_/g' | awk -F ":" '{ system("git stash show -p " $1 " >> " $1$2$3 ".diff" ) }'
@kinwahlai
kinwahlai / mitmproxy cheat sheet
Created August 9, 2019 04:36 — forked from 2bard/mitmproxy cheat sheet
mitmproxy cheat sheet
Movement:
j, k down, up
h, l left, right (in some contexts)
space page down
pg up/down page up/down
arrows up, down, left, right
@kinwahlai
kinwahlai / UICollectionViewScroll.swift
Created February 22, 2018 16:31 — forked from jlnquere/UICollectionViewScroll.swift
XCUITests: scroll UICollectionView to find one of it's offscreen UICollectionViewCell by id
// Thanks to @MonsieurDart for the idea :)
func scroll(collectionView:XCUIElement, toFindCellWithId identifier:String) -> XCUIElement? {
guard collectionView.elementType == .collectionView else {
fatalError("XCUIElement is not a collectionView.")
}
var reachedTheEnd = false
var allVisibleElements = [String]()
while !reachedTheEnd {

Vim Alphabet

a

a enter into insert mode after the character your cursor is on

A enter into insert mode at the end of the current line

b

@kinwahlai
kinwahlai / xcode_ramdisk.sh
Created July 18, 2017 04:30 — forked from derjohng/xcode_ramdisk.sh
Create a RAM disk for using with XCode, with Umount disks method
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
DEV_CACHES_DIR="/Users/$USERNAME/Library/Developer/Xcode/DerivedData"
DEV_CACHES_SHADOW_DIR="/Users/$USERNAME/Library/Developer/Xcode/DerivedData_shadow"
@kinwahlai
kinwahlai / gist:ea95665b88eacbb6a611
Created March 1, 2016 04:18 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@kinwahlai
kinwahlai / raspberry-pi-vpn-router.md
Created February 12, 2016 00:47 — forked from superjamie/raspberry-pi-vpn-router.md
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2015-09-24-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@kinwahlai
kinwahlai / byobuCommands
Created December 23, 2015 21:47 — forked from jshaw/byobuCommands
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window