Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
fancy_echo() {
local fmt="$1"; shift
printf "\n$fmt\n" "$@"
}
append_to_zshrc() {
local text="$1" zshrc
#!/bin/sh
echo "Creating Swap file... (Size: 2GB)"
#sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048 &&
sudo fallocate -l 2G /var/swapfile && # A new and effective way since Linux 2.6.23
sudo chmod 600 /var/swapfile &&
sudo mkswap /var/swapfile &&
echo "/var/swapfile none swap defaults 0 0" | sudo tee -a /etc/fstab
sudo swapon -a
echo "Done. Happy swapping!"
@JosephKu
JosephKu / README.md
Last active February 3, 2022 05:16
Street Fighter x Mega Man for Mac

STREET FIGHTER® X MEGA MAN® for Mac

STORY

Having fought countless robot masters over the years, Mega Man is ready to lay back, relax and enjoy his 25th Anniversary. Getting wind of this, Ryu and his fellow Street Fighters want one last battle before they let their own anniversary finish. Charge up your mega busters and stretch out your lightning legs, this is Street Fighter® X Mega Man®!

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@JosephKu
JosephKu / sublime_text_keyrepeat.sh
Created March 11, 2015 13:14
Enable/Disable key repeat for Sublime Text 2/3 in Vintage/Vintageous mode
#!/bin/sh
sublime_domain=$(defaults domains | tr "," "\n" | grep sublime)
if [ $? -eq 0 ]; then
ret=$(defaults read $sublime_domain ApplePressAndHoldEnabled)
if [ $ret -eq 0 ]; then
defaults write $sublime_domain ApplePressAndHoldEnabled -bool true
echo "Disable key repeat."
else
@JosephKu
JosephKu / caps_lock.json
Last active October 17, 2017 18:21
KE-complex_modifications
{
"title": "Change caps_lock key",
"rules": [
{
"description": "Post caps_lock if caps_lock is pressed alone, left_ctrl otherwise.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
@JosephKu
JosephKu / WindowsSharedMemorySample-Read.cpp
Last active May 10, 2017 07:01
Windows named share memory sample
#include <Windows.h>
#include <stdio.h>
int main()
{
int shmem_size = sizeof(unsigned int);
HANDLE shmem = INVALID_HANDLE_VALUE;
HANDLE mutex = INVALID_HANDLE_VALUE;
mutex = CreateMutex(NULL, FALSE, L"mutex_name");
@JosephKu
JosephKu / upgrade-phabricator.sh
Last active February 14, 2017 04:45
Phabricator upgrading script
#!/bin/sh
# This script only works on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux
set -ex
ROOT=`pwd`
# Stop related services
$ROOT/phabricator/bin/phd stop
@JosephKu
JosephKu / vimrc
Last active November 4, 2016 19:44
Vimrc
" vim-plug
fun! EnsureVimPlugIsOnDisk(vimplug_install_path)
if !filereadable(a:vimplug_install_path.'/plug.vim')
\&& 1 == confirm("Install vim-plug into ".a:vimplug_install_path."?","&Y\n&N")
execute '!curl -fLo '.a:vimplug_install_path.'/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
endif
endfun
fun! SetupVimPlug()
let vimplug_install_path = expand('$HOME').'/.vim/autoload'
@JosephKu
JosephKu / .profile
Last active September 13, 2016 15:20
Bash profile file for Mac OS X
# .profile for Bash on Mac OS X
#
# Written by Joseph Ku <chiehfang.ku@gmail.com>
# All right reserved.
# 'ls' with colors
export CLICOLOR=1
#export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
#export LSCOLORS=ExxxxxDxBxegedabxxacad
export LSCOLORS=ExFxCxDxBxegedabagacad