Skip to content

Instantly share code, notes, and snippets.

View reyesyang's full-sized avatar

Yang Hailong reyesyang

View GitHub Profile
@reyesyang
reyesyang / init-ubuntu.sh
Last active March 22, 2024 04:21
Init Ubuntu
sudo apt update
# Install compile toolchain
sudo apt-get install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev
# Install tools
sudo apt install vim tmux net-tools mysql-client mysql-server redis git tig tree htop neofetch
# Install fonts
sudo apt install fonts-noto-cjk fonts-noto-cjk-extra fonts-jetbrains-mono fonts-firacode
@reyesyang
reyesyang / init-wsl-ubuntu.sh
Last active March 22, 2024 05:11
Initialize WSL Ubuntu
sudo apt update
# Install compile toolchain
sudo apt-get install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev \
libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev ntpdate
# Support AppImages app, Such as jetbrains-toolbox
sudo add-apt-repository universe
sudo apt install libfuse2
@reyesyang
reyesyang / .gemrc
Created June 22, 2017 03:33 — forked from jch/.gemrc
gemrc example
# http://docs.rubygems.org/read/chapter/11
---
gem: --no-ri --no-rdoc
benchmark: false
verbose: true
update_sources: true
sources:
- http://gems.rubyforge.org/
- http://rubygems.org/
backtrace: true
@reyesyang
reyesyang / .gtkrc-eclipse
Created June 6, 2017 03:25 — forked from andrioli/.gtkrc-eclipse
Config to make Eclipse Juno icons and tabs look small and nice in Linux
# Create a new file in your home directory called .gtkrc-eclipse
# call eclipse with this command:
# Gtk2 forced:
# export SWT_GTK3=0
# env GTK2_RC_FILES=/usr/share/themes/<YourTheme>/gtk-2.0/gtkrc:/home/<YourUser>/.gtkrc-eclipse '/path_to_eclipse/eclipse'
# In your Eclipse directory find the file 'e4_default_gtk.css'
# In this file there's a CSS class:
@reyesyang
reyesyang / bootstrap.sh
Created March 18, 2017 14:43
Bootstrap a fresh ubuntu machine with dev tools
#!/bin/bash
echo '***** Build tools *****'
sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
echo '***** Dev tools *****'
sudo apt install -y git gitg tmux vim-gnome exuberant-ctags memcached redis-server\
mysql-server mongodb postgresql haskell-platform libmysqlclient-dev ipython python-dev\
libsqlite3-dev ubuntu-make
@reyesyang
reyesyang / net_http.rb
Last active June 2, 2016 10:07
Net::HTTP examples
require 'net/http'
# Proxy
proxy_server = 'xxx.xxx.xxx.xxx'
proxy_port = 81
## Example 1
Net::HTTP.new('baidu.com', nil, proxy_server, proxy_port).start { |http| http.get '/' }
## Example 2
@reyesyang
reyesyang / nancy.rb
Created December 1, 2015 10:06
Nancy is a Sinatra like micro framework for study base on thoughtbot blog: https://robots.thoughtbot.com/lets-build-a-sinatra
require 'rubygems'
require 'bundler/setup'
require 'rack'
require 'pry'
module Nancy
METHODS = %w(get post put patch delete head)
class Base
# https://robots.thoughtbot.com/writing-a-domain-specific-language-in-ruby
module Smokestack
@registry = {}
def self.registry
@registry
end
def self.define(&block)
@reyesyang
reyesyang / kaminari-i18n-zh-CN.yml
Last active August 29, 2015 14:25
Kaminari I18n translation in zh-CN language
# Usage:
# 1. Put this file in config/locales/kaminari/zh-CN.yml
# 2. Set load_path in config/application.rb as below:
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
zh-CN:
views:
pagination:
first: "&laquo; 首页"
last: "末页 &raquo;"
@reyesyang
reyesyang / genrsa.sh
Created July 16, 2015 11:12
Generate SSL Key, CSR and Self Signed Certificate
# Generate Private Key:
openssl genrsa -out server.key 1024
# Generate a Certificate Signing Request (CSR)
openssl req -new -key server.key -out server.csr
# Generate a Self-Signed SSL Certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt