Skip to content

Instantly share code, notes, and snippets.

View hutusi's full-sized avatar
🧶

John Hu hutusi

🧶
View GitHub Profile
#!/bin/sh
#
# This script will make WinMerge your default tool for diff and merge.
# It must run inside git bash (on Windows)
#
# If your WinMerge is in other place then this one, please edit
WINMERGE_SCRIPT="winmerge-merge.sh"
@hutusi
hutusi / smtp_settings.rb
Last active December 25, 2015 08:58
GitLab 6.1 email (smtp) configuration.
# To enable smtp email delivery for your GitLab instance do next:
# 1. Change config/environments/production.rb to use smtp
# config.action_mailer.delivery_method = :smtp
# 2. Rename this file (config/initializers/smtp_settings.rb) to smtp_settings.rb
# 3. Edit settings inside this file
# 4. Restart GitLab instance
#
if Gitlab::Application.config.action_mailer.delivery_method == :smtp
ActionMailer::Base.smtp_settings = {
address: "smtp.gmail.com",
REST
https://restful-api-design.readthedocs.org/en/latest/methods.html
@hutusi
hutusi / .rubocop.yml
Created October 9, 2017 14:06 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@hutusi
hutusi / model.rb
Created October 7, 2019 06:55
Organizing-Ruby-on-Rails-Models
class User < ActiveRecord::Base
# == Constants ============================================================
# == Attributes ===========================================================
# == Extensions ===========================================================
# == Relationships ========================================================
@hutusi
hutusi / latency.txt
Created April 14, 2021 08:12 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hutusi
hutusi / git paging.md
Last active January 1, 2024 15:56
Git checkout next / prev commit

Treat git log as a book, exec git next or git prev to checkout the next or the previous commit.

Please check hutusi/git-paging for updates.