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
# ~/.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 / gist:14e9698d267e849872cf
Created May 25, 2014 16:12 — forked from rozap/gist:10946749
Install elixir on Ubuntu
#!/bin/sh
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install -y erlang
sudo apt-add-repository -y ppa:bigkevmcd/elixir
sudo apt-get update
sudo apt-get install -y elixir
@ghawkgu
ghawkgu / FHlfi.markdown
Created April 27, 2014 18:14
A Pen by Yi Gu.
@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)
@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;
}
}
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')