Skip to content

Instantly share code, notes, and snippets.

View vochicong's full-sized avatar
🐒
NLP/ML/AI

Cong vochicong

🐒
NLP/ML/AI
View GitHub Profile
@vochicong
vochicong / sync_with_upstream.sh
Created July 6, 2017 15:02
Sync a fork of a repository to keep it up-to-date with the upstream repository.
# Sync a fork of a repository to keep it up-to-date with the upstream repository.
# https://help.github.com/articles/syncing-a-fork/
git fetch upstream
git checkout master
git merge upstream/master
git push
@vochicong
vochicong / 0-install-docker-ubuntu.md
Last active August 18, 2017 07:18
Install Docker into Ubuntu 14.04 LTS
@vochicong
vochicong / mysql_macosx.md
Created August 10, 2017 00:05 — forked from jnoss/mysql_macosx.md
mysql on mac osx

Install and run mysql on mac os x

Instructions for installing mysql on mac os x via homebrew (a command line package manager for mac)

Install brew

Follow installation instructions at https://brew.sh/

Install mysql

Reset MySQL root password on Mac

On Terminal 1

mysql.server stop
mysqld_safe --skip-grant-tables

On Terminal 2

@vochicong
vochicong / gem-rmagic-mac.sh
Created September 4, 2017 04:46
install rmagic on mac
brew install imagemagick@6
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
export LDFLAGS=-L/usr/local/opt/imagemagick@6/lib:$LDFLAGS
export CPPFLAGS=-I/usr/local/opt/imagemagick@6/include:$CPPFLAGS
export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig:$PKG_CONFIG_PATH
gem install rmagic
# https://stackoverflow.com/questions/10063051/bundle-cant-install-rmagick-gem-on-mac-osx-10-7
@vochicong
vochicong / extract_json_from_csv.sh
Created September 12, 2017 05:50
jq to extract a json value from CSV
# Input: 901,1,187,7,1,example@gmail.com,"{""u"":""name"",""limit_date"":""2017/09/18 23:59"",""token"":""b0kasdfuadf3jdadfubd"",""language"":""ja""}",9/12/17 9:01,NULL,NULL,NULL,9/11/17 15:59,9/11/17 16:00,NULL
# Output: b0kasdfuadf3jdadfubd
cat token_lists.csv | jq -R 'split(",") | .[8] | split("\"") | .[6]' | sed 's/"//g'
@vochicong
vochicong / gist:eff000b99a8d8667c2d5c6007daa8cc1
Created October 1, 2017 12:15
Update to macOS High Sierra
macOS High Sierra
https://www.apple.com/jp/macos/high-sierra/
Xcode 9
https://developer.apple.com/download/
xcode-select --install
brew upgrade
@vochicong
vochicong / BleakWanZebrafinch.rb
Created December 9, 2017 05:38
BleakWanZebrafinch created by anonymous - https://repl.it/repls/BleakWanZebrafinch
3 <=> 4
3 > 4
Class Steak
include Comparable
attr_accessor grade
GRADES = { prime: 1, choice: 2, select: 3 }
def <=>(other)
# File: config/initializers/params_snakeizer.rb
# Transform JSON request param keys from JSON-conventional camelCase to
# Rails-conventional snake_case
module ActionController
# Modified from action_controller/metal/strong_parameters.rb
class Parameters
def deep_snakeize!
@parameters.deep_transform_keys!(&:underscore)
self
end