Skip to content

Instantly share code, notes, and snippets.

View tsechingho's full-sized avatar

Tse-Ching Ho tsechingho

View GitHub Profile
@tsechingho
tsechingho / vips install script at al2023.md
Last active June 9, 2023 06:52
Install vips 8.14.2 in Amazon Linux 2023 from source code

Install vips 8.14.2 into /usr/local in Amazon Linux 2023 from source code

packages ref: https://docs.aws.amazon.com/linux/al2023/release-notes/all-packages.html

sudo yum groupinstall 'Development Tools'
sudo pip3 install meson
# compile dependencies
sudo yum install glib2-devel expat-devel gobject-introspection-devel cmake ninja-build
# image library dependencies
@tsechingho
tsechingho / bundler_config.rake
Last active June 3, 2020 11:58
Temporary solution for deprecation warnings of bundler v2.1+ for capistrano-bundler
# frozen_string_literal: true
# Temporary solution for deprecation warnings of bundler v2.1+.
# https://github.com/capistrano/bundler/issues/115
namespace :load do
task :defaults do
set :bundle_flags, '--quiet'
set :bundle_path, nil
set :bundle_without, nil
@tsechingho
tsechingho / naming_rules.md
Last active August 3, 2017 04:47
Naming rules

Naming rules

Services

Namespace

  • 請優先以業務類型的複數命名。
  • 在業務類型下,以 3rd party provider 名稱或子業務作細項區分。
@tsechingho
tsechingho / postgres_queries_and_commands.sql
Created April 12, 2017 09:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@tsechingho
tsechingho / rails http status codes
Created March 18, 2016 07:28 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
職務名稱: Rails 工程師
需求人數: 1 - 2 人
職務類別: 軟體設計工程師、Internet程式設計師
工作單位:
* 國立陽明大學 生物資訊研究所 楊永正實驗室
工作項目:
* 生物資訊系統開發。
* 有參與國際合作計畫之機會,歡迎有志者加入。
職能要求:
@tsechingho
tsechingho / complex_sass
Last active August 29, 2015 14:18
slim_sass_coffee
// http://thesassway.com/advanced/inverse-trigonometric-functions-with-sass
$default-threshold: pi() / 180 / 20
@function convert-angle($value, $unit-name)
$factors: (rad: 1rad, deg: 180deg / pi(), grad: 200grad / pi(), turn: 0.5turn / pi())
@if not unitless($value)
@warn "`#{$value}` should be unitless"
@return false
@if not map-has-key($factors, $unit-name)
@tsechingho
tsechingho / ability.rb
Last active August 29, 2015 14:13
cancancan abilities
# app/models/ability.rb
module Ability
class << self
def ability_for user, options = {}
abilities = AnonymousAbility.new
return abilities unless user
abilities.merge MemberAbility.new user, options
@tsechingho
tsechingho / unicorn.conf
Created December 1, 2014 08:35
unicorn example
## development
# app_path = `pwd`.strip
# app_shared_path = app_path
# app_current_path = app_path
# master_port = 4000
## production
app_path = '/srv/deploy/ufolio'
app_shared_path = "#{app_path}/shared"
app_current_path = "#{app_path}/current"
@tsechingho
tsechingho / unicorn.cap
Created March 31, 2014 11:28
capistrano 3 examples
namespace :load do
task :defaults do
set :unicorn_bin, :unicorn_rails
set :unicorn_pid, -> { shared_path.join('tmp', 'pids', 'unicorn.pid') }
set :unicorn_config, -> { current_path.join('config', 'unicorn.rb') }
set :unicorn_gemfile, -> { current_path.join('Gemfile') }
set :unicorn_env, -> { fetch(:rails_env) || fetch(:stage) }
set :unicorn_roles, :app
set :unicorn_sleep, 2
end