Skip to content

Instantly share code, notes, and snippets.


Wiwatta Mongkhonchit zentetsukenz

View GitHub Profile
zentetsukenz /
Created Jul 23, 2017
OpenAI Gym - Cart Pole v0 - Q learning
import pandas as pd
import numpy as np
import gym
from gym import wrappers
def build_state(observation, feature_bins):
return_val = ""
for i in range(len(feature_bins)):
return_val = return_val + str(np.digitize([observation[i]], feature_bins[i])[0])
return int(return_val)
zentetsukenz / tmux.conf
Last active Apr 26, 2017 — forked from spicycode/tmux.conf
View tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
zentetsukenz /
Last active May 12, 2020
Step of how to connect to host database from Docker network

Connect to host database

  1. Create new database user with password for docker.
  2. Configure postgresql.conf to listen for connection from docker network which usually is The file's usually located at /usr/local/var/postgres/postgresql.conf for Mac OS X.

Example, add this entry into postgresql.conf file.

listen_addresses = ', localhost'
zentetsukenz /
Last active Feb 22, 2021
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease


Files and Folders.

|\_ app
|\_ docker
| |

Keybase proof

I hereby claim:

  • I am zentetsukenz on github.
  • I am zentetsuken ( on keybase.
  • I have a public key whose fingerprint is A806 B364 D7DA 20B7 6823 313B D576 6A02 170C 4847

To claim this, I am signing this object:

zentetsukenz / ruby_sum_object_array.rb
Last active Feb 23, 2016
Ruby sum array of object map reduce style
View ruby_sum_object_array.rb
Class A
attr_accessor :name, :value
def initialize
@value = rand(10)
@name = "Mr. #{@value}_#{rand(100)}"
a = { |e| e = }
zentetsukenz / benchmarking.rb
Created Feb 8, 2016
Benchmark somethings and get the raw result in file
View benchmarking.rb
# gem install ascii_charts # if necessary
require 'ascii_charts'
require 'benchmark'
require './test.rb'
include Benchmark
class Runner
zentetsukenz / ruby_hash_value_mismatch.rb
Created Feb 2, 2016
Find mismatch value between 2 hash
View ruby_hash_value_mismatch.rb
def find_mismatch_value_between_hash(a, b)
pivot_hash = a
another_hash = b
result_hash = {}
pivot_hash.keys.each do |k|
pivot_value = pivot_hash[k]
another_value = another_hash[k]
View ruby_sum_array_of_object.rb { |object| object.field_to_sum }.inject(:+)
View rails_add_foreign_key_migration.rb
add_foreign_key :source_table_name, :target_table_name, column: :explicit_column_name