Skip to content

Instantly share code, notes, and snippets.

View xiaohk's full-sized avatar
🐐
Mr. King Chivo

Jay Wang xiaohk

🐐
Mr. King Chivo
View GitHub Profile
@steakunderscore
steakunderscore / arm-elf-gcc_on_osx.sh
Created June 22, 2011 10:46 — forked from Nemo157/arm-eabi-gcc_on_osx.markdown
How I installed arm-elf-gcc on Mac OS X
#!/bin/bash
mkdir toolchain
cd toolchain
wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
wget http://ftp.gnu.org/gnu/gdb/gdb-7.2.tar.gz
wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.tar.bz2
wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/gcc-core-4.6.0.tar.bz2
@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@cobyism
cobyism / gh-pages-deploy.md
Last active July 5, 2024 05:07
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@jhoff
jhoff / md5.js
Created November 27, 2013 18:27
Closure of Joseph's Myers md5 javascript implementation
/*
* http://www.myersdaily.org/joseph/javascript/md5-text.html
*/
(function() {
var md5cycle = function(x, k) {
var a = x[0], b = x[1], c = x[2], d = x[3];
a = ff(a, b, c, d, k[0], 7, -680876936);
@lmullen
lmullen / shapefile.r
Last active January 26, 2022 22:07
How I use shapefiles in R with ggplot2 and RGDAL
library(rgdal) # R wrapper around GDAL/OGR
library(ggplot2) # for general plotting
library(ggmaps) # for fortifying shapefiles
# First read in the shapefile, using the path to the shapefile and the shapefile name minus the
# extension as arguments
shapefile <- readOGR("path/to/shapefile/", "name_of_shapefile")
# Next the shapefile has to be converted to a dataframe for use in ggplot2
shapefile_df <- fortify(shapefile)
@yig
yig / Latex space saving tricks
Last active June 19, 2024 20:21
Latex space saving tricks
%% Make everything look better.
%% http://tex.stackexchange.com/questions/553/what-packages-do-people-load-by-default-in-latex
%% http://www.howtotex.com/packages/9-essential-latex-packages-everyone-should-use/
\usepackage{microtype}
%% Shrink space around figures.
%% This beats manually adding negative \vspace commands everywhere.
%\setlength{\textfloatsep}{0pt}
%\setlength{\textfloatsep}{20pt plus 2pt minus 4pt}
%\setlength{\textfloatsep}{10pt plus 2pt minus 4pt}
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
@xiaohk
xiaohk / uni.py
Created February 21, 2017 01:43
How Python3 deals with unicode character and code point
zh = 'U+5EB8'
print(zh) # U+5EB8
zh = '\u5EB8'
print(zh) # 庸
zh = '\\u5EB8'
print(zh) # \\u5EB8
print(zh.decode('unicode-escape')) # AttributeError: 'str' object has no attribute 'decode'
print(zh.encode('ascii').decode('unicode-escape')) # 庸
@chsh
chsh / Flat UI Colors.clr
Last active June 18, 2024 14:17
Some color pallets with Apple Color List (.clr) format
@fukaz55
fukaz55 / trackobot-post-test.php
Last active December 19, 2018 06:08
track-o-botに戦歴をPOSTするテストスクリプト
<?php
/* お手本:https://gist.github.com/stevschmid/120adcbc5f1f7cb31bc5 */
$api = 'https://trackobot.com/profile/results.json';
$username = 'username';
$token = 'YOUR_API_TOKEN';
$headers = array(
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode("{$username}:{$token}") /* BASIC認証用のヘッダを生成 */
);