Open ~/.bash_profile
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
:: Make --no-ri --no-rdoc default gem install options (without documentation) | |
:: Possible variations: | |
:: For every user: | |
:: echo gem: --no-ri --no-rdoc > "%PROGRAMDATA%\gemrc" | |
:: Only for you | |
:: echo gem: --no-ri --no-rdoc >> "%USERPROFILE%\.gemrc" | |
:: | |
:: Note: In Windows, %PROGRAMDATA% is /etc on Linux | |
:: | |
:: But finally, the best way to do it. See: http://stackoverflow.com/a/7662245/1579985 |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# app/models/image.rb | |
class Image < ActiveRecord::Base | |
has_many :taggings, :as => :taggable | |
has_many :tags, :through => :taggings | |
end |
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### # | |
# | |
# _dockerfile/mysql/conf.d/my.cnf | |
# Last update: 2017-01-05_10h05 | |
# | |
# This mysql config is made to run within the official mysql container. | |
# https://hub.docker.com/_/mysql/ | |
# | |
# Inspired by: | |
# https://www.percona.com/blog/2016/10/12/mysql-5-7-performance-tuning-immediately-after-installation/ |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"os" | |
) | |
func main() { | |
decoder := json.NewDecoder(os.Stdin) |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
"os/exec" | |
"strings" | |
) |
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
There are three main concepts with Rust:
These are fairly simple concepts, but they are often counter-intuitive to concepts in other languages, so I wanted to give a shot at
# -*- coding:utf-8 -*- | |
from __future__ import absolute_import | |
from __future__ import unicode_literals | |
from __future__ import print_function | |
import json | |
import uuid | |
import time | |
import gevent |