Skip to content

Instantly share code, notes, and snippets.

View r6m's full-sized avatar
🏠
Working from home

Reza r6m

🏠
Working from home
  • localhost
View GitHub Profile
@r6m
r6m / shell_output.go
Created January 23, 2018 07:38 — forked from hivefans/shell_output.go
get the realtime output for a shell command in golang
package main
import (
"bufio"
"fmt"
"io"
"os"
"os/exec"
"strings"
)
@r6m
r6m / golang-json-stream-decoder
Created January 2, 2018 17:48 — forked from atedja/golang-json-stream-decoder
Example of using JSON Stream Decoder from STDIN
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
decoder := json.NewDecoder(os.Stdin)
@r6m
r6m / my-custom.cnf
Created December 22, 2017 16:19 — forked from pascalandy/my-custom.cnf
This mysql config is made to run within the official mysql container.
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
# _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/
@r6m
r6m / image.rb
Last active December 18, 2017 05:55 — forked from seancdavis/image.rb
Rails has_many :through Polymorphic Association (http://goo.gl/lxmehk)
# app/models/image.rb
class Image < ActiveRecord::Base
has_many :taggings, :as => :taggable
has_many :tags, :through => :taggings
end
@r6m
r6m / 0_reuse_code.js
Created January 2, 2017 10:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@r6m
r6m / *.bat
Created January 30, 2016 18:51 — forked from michfield/*.bat
Install Gems without documentation #ruby #windows
:: 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