Skip to content

Instantly share code, notes, and snippets.

@pihao
pihao / ANSI.md
Created November 19, 2023 10:50 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@pihao
pihao / xkb-options.txt
Last active February 17, 2022 15:47 — forked from jatcwang/gist:ae3b7019f219b8cdc6798329108c9aee
List of all setxkbmap configuration options (including models/layout/etc)
! model
pc101 Generic 101-key PC
pc102 Generic 102-key (Intl) PC
pc104 Generic 104-key PC
pc105 Generic 105-key (Intl) PC
dell101 Dell 101-key PC
latitude Dell Latitude series laptop
dellm65 Dell Precision M65
everex Everex STEPnote
flexpro Keytronic FlexPro
@pihao
pihao / install_monaco_font.sh
Created September 10, 2018 15:33 — forked from rogerleite/install_monaco_font.sh
Install Monaco font in Linux
#!/bin/bash
#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/
cd /usr/share/fonts/truetype/
#TODO: put validation if folder already exists
sudo mkdir ttf-monaco
# Rime alternative settings
# encoding: utf-8
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
# (Linux) ~/.config/ibus/rime/alternative.yaml
# (Mac OS) ~/Library/Rime/alternative.yaml
@pihao
pihao / sinatra_app.rb
Last active August 29, 2015 14:06 — forked from deps/gist:6028795
#coding:utf-8
require 'sinatra'
# Set port for compatability with Nitrous.IO
configure :development do
set :bind, '0.0.0.0'
set :port, 4567 # Not really needed, but works well with the "Preview" menu option
end
@pihao
pihao / as3_math_ceil_function_performance.as
Last active August 29, 2015 14:06
Test ActionScript 3.0 `Math.ceil()` function performance
package
{
import flash.display.Sprite;
import flash.utils.getTimer;
/**
* @author pihao
* Environment:
* Macbook Pro with OS X 10.9.4
* Flash Player 15.0.0.152
@pihao
pihao / resize-mac-window.scpt
Last active August 29, 2015 14:02
Resize mac window to the left/right half of the screen
(* Get screen size *)
tell application "Finder"
set screenSize to bounds of window of desktop
set screenW to item 3 of screenSize
set screenH to item 4 of screenSize
end tell
(* Get front most window *)
tell application "System Events"
set myFrontmost to name of first item of (processes whose frontmost is true)