Skip to content

Instantly share code, notes, and snippets.

@ghawkgu
ghawkgu / gist:213c726fc087ec9f2306c9b023a3658a
Created January 23, 2021 15:58
crosstool-ng on Ubuntu 20.04
sudo apt install build-essential autoconf bison flex texinfo \
help2man gawk libtool libtool-bin libtool-doc libncurses5-dev python3-dev \
python3-distutils git unzip
git clone http://github.com/crosstool-ng/crosstool-ng
cd crosstool-ng
./bootstrap
./configure --enable-local
DEFCONFIG=samples/armv8-rpi3-linux-gnueabihf/crosstool.config ./ct-ng defconfig
@ghawkgu
ghawkgu / ssh_client.py
Created April 27, 2011 10:18
Python ssh client sample
#!/usr/bin/env python
import paramiko
hostname = 'localhost'
port = 22
username = 'foo'
password = 'xxxYYYxxx'
if __name__ == "__main__":
@ghawkgu
ghawkgu / .tmux.conf
Last active July 29, 2019 03:24
tmux settings
#utf setting
# set-window-option -g utf8 on "Deprecated since 2.2"
set-window-option -g mode-keys vi
# set-window-option -g automatic-rename off
setw -g automatic-rename off
set -s escape-time 0
setw -g window-status-current-style underscore
# Since tmux 1.8, we can use copy-pipe to utilize the system-wide clipboard.
def wpautop(pee, br = true)
return '' if pee.strip == ''
pee = "#{pee}\n" # just to make things a little easier, pad the end
pee = pee.gsub(/<br \/>\s*<br \/>/, "\n\n")
# pace things out a little
allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
pee = pee.gsub(Regexp.new('(<'+allblocks+'[^>]*>)'), "\n"+'\1')
pee = pee.gsub(Regexp.new('(<\/'+allblocks+'[^>]*>)'), '\1' + "\n\n")
pee = pee.gsub(/\r\n|\r/, "\n") # cross-platform newlines
if pee.include?('<object')
@ghawkgu
ghawkgu / gist:4621586
Last active April 5, 2018 20:25
Intercept the request of uiwebview, add customized header in the request. For detailed info, read http://www.nomadplanet.fr/2010/09/custom-http-headers-for-every-request-made-in-uiwebviews/ .
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)aRequest navigationType:(UIWebViewNavigationType)navigationType {
NSDictionary *headers = [aRequest allHTTPHeaderFields];
BOOL hasWhateverAddedHeader = NO;
for(NSString *key in [headers allKeys]) {
if([[key lowercaseString] isEqualToString:@"my-added-header"]) {
hasWhateverAddedHeader = YES;
break;
}
}
# ~/.oh-my-zsh/custom/tjkirch-with-ruby.zsh-theme
function _update_ruby_version()
{
typeset -g ruby_version=''
if which rvm-prompt &> /dev/null; then
ruby_version="$(rvm-prompt i v g)"
rvm-prompt i v g
else
if which rbenv &> /dev/null; then
@ghawkgu
ghawkgu / tjkirch-with-ruby.zsh-theme
Created December 24, 2013 01:28
A simple 2-line theme for oh-my-zsh.
function _update_ruby_version()
{
typeset -g ruby_version=''
if which rvm-prompt &> /dev/null; then
ruby_version="$(rvm-prompt i v g)"
rvm-prompt i v g
else
if which rbenv &> /dev/null; then
ruby_version="$(rbenv version | sed -e "s/ (set.*$//")"
fi
@ghawkgu
ghawkgu / gist:6291273
Last active December 21, 2015 10:19
Retrieve single file from remote repository with git.
git archive --remote {remote repository} {branch name/tree-ish} {file path} | tar -x --strip-components={directory depth}
@ghawkgu
ghawkgu / gist:5003326
Last active December 14, 2015 00:59
Tencent Weibo iOS SDK (v2.0) Manual

Tencent weibo (腾讯微博) iOS SDK マニュアル

中国語版へ

概要

SDKの機能概要

本SDKは下記の機能を含めています。

  • Tencent Weiboの認証(OAuth 2.0)
  • Tencent WeiboのAPI
  • 投稿、シェアモジュール
@ghawkgu
ghawkgu / README.md
Last active December 13, 2015 23:48
QQ iOS SDK Manual (v1.3)