This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage sample: echo Let\'s ${RED}color${CLEAR} text! | |
CLEAR='\033[0m' | |
BLACK='\033[0;30m' | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[0;33m' | |
BLUE='\033[0;34m' | |
MAGENTA='\033[0;35m' | |
CYAN='\033[0;36m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(private iab: InAppBrowser) {} | |
openUrl(url: string, externalBrowser: boolean = false) { | |
const target = externalBrowser ? '_system' : '_blank'; | |
this.iab.create(url, target, TopicDetailPage.options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Java use IPv4 for jenkins | |
alias jenkins='env _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true" jenkins' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zmv | |
autoload -Uz zmv | |
alias zmv='noglob zmv -W' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cd to parent directory of the file (even if it is symbolic link) | |
function pd() { | |
local dir=`realpath ${1:-.}` | |
cd $dir(:A:h) | |
} | |
# alias -g ...=../../, ....=../../../, .....=../../../../, ...... | |
`ruby -e "(2..20).each{|i| puts 'alias -g .'+'.'*i+'='+'../'*i}"` | |
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
(){ | |
local plistfile="$HOME/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist" | |
local i=0 | |
while [[ $i != "false" ]]; do | |
[[ `/usr/libexec/PlistBuddy -c "Print :LSHandlers:$i" $plistfile 2>/dev/null` ]] || break | |
ext=`/usr/libexec/PlistBuddy -c "Print :LSHandlers:$i:LSHandlerContentTag" $plistfile 2>/dev/null` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zle-pbcopy-buffer(){ echo -n ${(z)BUFFER} | pbcopy } | |
zle -N zle-pbcopy-buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
() { # zcompile if needed | |
local src | |
for src in $@; do | |
([[ ! -e $src.zwc ]] || [[ $src:A -nt $src.zwc ]]) && zcompile $src | |
done | |
} ~/.zshenv ~/.zshrc ~/.zprofile ~/.zlogin ~/.zlogout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Hanoi { | |
class HanoiTower { | |
static void Main(string[] args) { | |
int height; | |
if (args.Length == 0 || !int.TryParse(args[0], out height)) height = 3; | |
var count = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'json' | |
# your my softbank login id and password | |
phone = "***********" | |
password = "********" | |
agent = Mechanize.new | |
agent.user_agent_alias = 'iPhone' | |
agent.follow_meta_refresh = true |