Skip to content

Instantly share code, notes, and snippets.

View ihower's full-sized avatar
🎯
Focusing

Wen-Tien Chang ihower

🎯
Focusing
View GitHub Profile
require 'pycall'
module LangChain
ChatModels = PyCall.import_module("langchain.chat_models")
LLMs = PyCall.import_module("langchain.llms")
Embeddings = PyCall.import_module("langchain.embeddings")
DocumentLoaders = PyCall.import_module("langchain.document_loaders")
TextSplitter = PyCall.import_module("langchain.text_splitter")
VectorStores = PyCall.import_module("langchain.vectorstores")
# https://support.apple.com/zh-tw/HT208050
export BASH_SILENCE_DEPRECATION_WARNING=1
# https://github.com/mrzool/bash-sensible
source ~/.sensible.bash
export PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin:$PATH
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/node@10/bin:$PATH"
[user]
name = Wen-Tien Chang
email = [email protected]
[alias]
co = checkout
ci = commit
st = status
br = branch -v
rt = reset --hard
# gem install twitter
require 'twitter'
# https://apps.twitter.com/
client = Twitter::REST::Client.new do |config|
config.consumer_key = "...."
config.consumer_secret = "...."
end
def collect_with_max_id(collection=[], max_id=nil, &block)
{"zh-CN"=>"简体中文", "zh-TW"=>"繁體中文", "ja"=>"日本語", "de"=>"Deutsch", "en"=>"English", "es"=>"Español", "fr"=>"Français", "it"=>"Italiano", "nl"=>"Nederlands", "pl"=>"polski", "pt"=>"Português", "tr"=>"Türkçe", "ru"=>"Русский", "ar"=>"العربية", "th"=>"ไทย", "ko"=>"한국어", nil=>"所有語言", "ach"=>"Acoli", "af"=>"Afrikaans", "ak"=>"Akan", "ay"=>"Aymara", "az"=>"azərbaycan", "ms"=>"Bahasa Melayu", "ban"=>"Balinese", "bho"=>"Bihari", "x-bork"=>"Bork, bork, bork!", "bs"=>"bosanski", "br"=>"brezhoneg", "ca"=>"català", "ceb"=>"Cebuano", "cs"=>"Čeština", "sn"=>"chiShona", "co"=>"Corsican", "cy"=>"Cymraeg", "da"=>"Dansk", "yo"=>"Èdè Yorùbá", "et"=>"eesti", "eo"=>"esperanto", "eu"=>"euskara", "ee"=>"Eʋegbe", "x-elmer"=>"Ewmew Fudd", "fil"=>"Filipino", "fo"=>"føroyskt", "gaa"=>"Ga", "ga"=>"Gaeilge", "gd"=>"Gàidhlig", "gl"=>"galego", "gn"=>"Guarani", "ht"=>"Haitian Creole", "ha"=>"Hausa", "hr"=>"Hrvatski", "haw"=>"ʻŌlelo Hawaiʻi", "bem"=>"Ichibemba", "ig"=>"Igbo", "rn"=>"Ikirundi", "id"=>"Indonesia", "ia"=>"Interlingua", "zu"=>"is
# 输入一个数组,表示每种书买本书,例如 [1,2,0,0,0] 是第一集买一本、第二集买两本
def book_price(order)
price = [0, 1 * 100, 0.95 * 200, 0.9 * 300, 0.8 * 400, 0.75 * 500 ]
order = order.reject{ |x| x <= 0 }
if order.size == 0
return 0
else
kind = order.count{ |x| x > 0 }
min_size = order.min
# https://github.com/mrzool/bash-sensible
source ~/.sensible.bash
alias stree='/Applications/SourceTree.app/Contents/Resources/stree'
alias x="exit"
alias c="clear"
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
@ihower
ihower / hello.rb
Last active May 11, 2016 19:50
a ruby example
"你好".force_encoding(Encoding::GB18030).encode(Encoding::UTF_8)
# => "浣犲ソ"
// golang 1.5.1
// go run hello.go
package main
import (
"fmt"
"log"
"net/http"
)
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
gzip_comp_level 5;