Skip to content

Instantly share code, notes, and snippets.

View openhoangnc's full-sized avatar
🌊
coding for living

Nguyen Cong Hoang openhoangnc

🌊
coding for living
  • Vietnam
View GitHub Profile
@openhoangnc
openhoangnc / Dock add app.sh
Created December 12, 2023 03:06 — forked from andrewpetrochenkov/mac-dock.sh
macOS Dock scripts
#!/usr/bin/env bash
path=/Applications/Automator.app
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$path</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock
@openhoangnc
openhoangnc / translatekeycodes.swift
Created December 9, 2022 10:44 — forked from vayn/translatekeycodes.swift
virtual key codes to unicode characters
func keyCodeToString(keyCode: CGKeyCode) -> String {
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData)
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr)
var deadKeyState: UInt32 = 0
var actualStringLength = 0
var unicodeString = [UniChar](count: 255, repeatedValue: 0)
let status = UCKeyTranslate(keyboardLayoutPtr,
@openhoangnc
openhoangnc / inputrc
Created August 28, 2020 04:54 — forked from snipe/inputrc
~/.inputrc for nice bash history up-arrows. This allows you to search through your history using the up and down arrows … i.e. type "cd /" and press the up arrow and you'll search through everything in your history that starts with "cd /". Create ~/.inputrc and fill it with this:
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@openhoangnc
openhoangnc / 1_WTF.md
Created October 11, 2018 04:11 — forked from valpackett/1_WTF.md
Kindle dictionary template

Kindle dictionary template

Use it with KindleGen

kindlegen dic.opf

@openhoangnc
openhoangnc / install_lastest_golang.sh
Last active January 24, 2018 11:54
Install lastest golang
#!/bin/sh
#sudo curl https://gist.githubusercontent.com/openhoangnc/1bb591e8843ac111c0661f5615eda0e1/raw/51933d70dd3e384cca69c0fdd835f6243ad38d12/install_lastest_golang.sh | sh
GOVERSION=1.9.3
GOOS=linux
GOARCH=amd64
TARFILE=go$GOVERSION.$GOOS-$GOARCH.tar.gz
TARFILEFULL=/tmp/$TARFILE
PROFILE=/etc/profile.d/golang.sh