Skip to content

Instantly share code, notes, and snippets.

View tanduong's full-sized avatar

Tan Duong tanduong

View GitHub Profile
@tanduong
tanduong / automobile.ipynb
Created May 27, 2017 10:36 — forked from martinwicke/automobile.ipynb
Estimator demo using Automobile dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tanduong
tanduong / reduceColection.js
Last active May 30, 2017 08:18
reduceColection redux
import { fromJS, List, Map } from 'immutable';
const reduceColection = (state, response) => {
if(response) {
const {
data,
page,
per_page,
total_count,
} = response;
@tanduong
tanduong / min-char-rnn.py
Created June 23, 2017 17:25 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@tanduong
tanduong / signal.py
Created August 14, 2017 17:40 — forked from HugoPresents/signal.py
limit execution time of a function call in Python
from __future__ import with_statement
import signal, time
from contextlib import contextmanager
def long_function_call():
while True:
if time.time() % 1 == 0:
print '*'
class TimeoutException(Exception): pass
# Raw transaction API example work-through
# Send coins to a 2-of-3 multisig, then spend them.
#
# For this example, I'm using these three keypairs (public/private)
# 0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU
# 04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk
# 048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw
# First: combine the three keys into a multisig address:
./bitcoind createmultisig 2 '["0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86","04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a9
@tanduong
tanduong / index.html
Created December 22, 2016 07:44
magnify effect
<!-- Lets make a simple image magnifier -->
<div class="magnify">
<!-- This is the magnifying glass which will contain the original/large version -->
<!-- This is the small image -->
<img class="small" src="http://thecodeplayer.com/uploads/media/iphone.jpg" width="200"/>
<div class="large"></div>
</div>
aaa
@tanduong
tanduong / tmux-cheatsheet.markdown
Created June 9, 2018 13:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tanduong
tanduong / db.rake
Created July 27, 2018 05:29
Pulling heroku db to local
namespace :db do
desc "Backs up heroku database and restores it locally."
task import_from_heroku: [ :environment, :create ] do
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote.
c = Rails.configuration.database_configuration[Rails.env]
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil
Bundler.with_clean_env do
puts "[1/4] Capturing backup on Heroku"
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}`
@tanduong
tanduong / graphql-get-schema.js
Created November 5, 2018 04:53
Get & write out graphql schema
const fs = require('fs');
require('isomorphic-fetch');
const {introspectionQuery, buildClientSchema, printSchema} = require('graphql');
function introspectionProvider(introspectionQuery) {
console.log(JSON.stringify({query: introspectionQuery}));
return fetch('https://marketplace-api.qa.kamereo.vn/graphql', {
method: 'post',
headers: {
Accept: 'application/json',