Skip to content

Instantly share code, notes, and snippets.

@ChiHsiang
ChiHsiang / myToReadBookLists.md
Created November 1, 2018 15:16 — forked from chusiang/myToReadBookLists.md
凍仁的讀書清單

凍仁的讀書清單

Migrated to chusiang/books2read at Tue Jun 5 14:26:12 CST 2018.

看了《學徒模式》一書後,凍仁試著用 Gist 管理自己的待讀書單,並不時修改其閱讀順序。您可以在 revisions 找到編修記錄。

目錄:

  1. 待讀書單
  2. 已讀書單
@ChiHsiang
ChiHsiang / rfc6749.md
Created October 1, 2018 04:00 — forked from yorkxin/rfc6749.md
RFC 6749 in Markdown - Edited from http://tools.ietf.org/rfc/rfc6749.txt
Internet Engineering Task Force (IETF)                     D. Hardt, Ed.
Request for Comments: 6749                                     Microsoft
Obsoletes: 5849                                             October 2012
Category: Standards Track
ISSN: 2070-1721

The OAuth 2.0 Authorization Framework

Abstract

@ChiHsiang
ChiHsiang / executor.rb
Last active December 31, 2017 16:58
refactor test
require './refactor_flight_tickets'
ticket = FlightTicket.build do
outbound_info do
from 'Taipie', 'TPE'
to 'Tokyo', 'NRT'
flight_number 'IT200'
airline 'Tigerair Taiwan'
flight_date 2017, 11, 28
departure_time 6, 35
@ChiHsiang
ChiHsiang / start-stop-example.sh
Created December 18, 2017 04:23 — forked from alobato/start-stop-example.sh
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
@ChiHsiang
ChiHsiang / popen3_test
Created October 20, 2017 08:35 — forked from chrisn/popen3_test
Ruby example of using Open3.popen3 with a select loop to read a child process's standard output and standard error streams.
#!/usr/bin/env ruby
require 'open3'
# Returns true if all files are EOF
#
def all_eof(files)
files.find { |f| !f.eof }.nil?
end
@ChiHsiang
ChiHsiang / blocked_matrix_mul.c
Created April 16, 2017 05:34 — forked from yangzhixuan/blocked_matrix_mul.c
分块矩阵乘法效率的实验
/*
* 执行同等大小的矩阵乘法10次的总时间(gcc version 4.8.1, 64位linux),第一项是取块大小为50的分块乘法,第二项是朴素乘法
*
* 无任何优化选项
* 500*500 8.05s 8.52s
* 1000*1000 64.96s 111.66s
*
* 开启O2
* 500*500 1.78s 1.89s
* 1000*1000 14.46s 88.94s
@ChiHsiang
ChiHsiang / avx.c
Last active March 7, 2017 16:24
SIMD-avx
#1
static inline
void add_vector(const double *a, const double *b, double *out)
{
for (int i = 0; i < 3; i++)
out[i] = a[i] + b[i];
}
==================================================================================================
#2
@ChiHsiang
ChiHsiang / hash_function.c
Last active February 28, 2017 11:25
Hash function
// BKDR Hash Function
version-1
unsigned int BKDRHash(char *str)
{
unsigned int seed = 131; // 31 131 1313 13131 131313 etc..
unsigned int hash = 0;
while (*str)

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql