Skip to content

Instantly share code, notes, and snippets.

View AlexChien's full-sized avatar

Boombastic AlexChien

View GitHub Profile
@AlexChien
AlexChien / tb.json
Last active March 30, 2021 10:01
tb
{
"ethereum": {
"address": [
{
"address": "0x4710573b853fdd3561cb4f60ec9394f0155d5105",
"balances": [
{
"currency": {
"symbol": "USDT"
},

Keybase proof

I hereby claim:

  • I am alexchien on github.
  • I am boombastic (https://keybase.io/boombastic) on keybase.
  • I have a public key ASCtlT0xcckmp-r90Xx0aV3z8CJ6_6OUL-s8ouBGn0mYJgo

To claim this, I am signing this object:

@AlexChien
AlexChien / gist:453a48cbe6d16b7e96c2325da4f307b5
Created July 22, 2017 14:05
0x008795718efe70dfaA6d6cd4633E1bD5c17aA68C
0x008795718efe70dfaA6d6cd4633E1bD5c17aA68C
@AlexChien
AlexChien / gist:5f55725ed731f449b4c856458c4aa3c8
Created March 30, 2017 17:42
aasm memory sqlite snippet
require 'active_record'
require 'sqlite3'
require 'logger'
require 'aasm'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
# ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.create_table :documents do |t|
t.string :aasm_state
// This is the rule definition for demo dice game
// All data structrue are defined in JSON in javascript, and being mapped to variant object in C++, be packed before storing in database
// Validate and parse this script before uploading, tools: http://lisperator.net/uglifyjs/parser
// require("play.js")
// TODO: Add the substitute for FC_CAPTURE_AND_THROW and FC_ASSERT
// TODO: Input: {game_input}, Output: {operation_game_data, wallet_transaction_record, game_result_transaction}
var
PLAY = PLAY || {},
@AlexChien
AlexChien / reboot.sh
Last active August 29, 2015 14:26
EC2 Spot Instance Startup Script
#!/bin/bash
base_address="0xa46b7974f4f43af50e9c4795251303d7066ed67f"
instance_type=`curl http://169.254.169.254/latest/meta-data/instance-type`
if [ "$instance_type" = "g2.2xlarge" ]; then
mining_thread=6
gpu=1
hashrate=9
elif [ "$instance_type" = "g2.8xlarge" ]; then

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@AlexChien
AlexChien / gist:4148863
Created November 26, 2012 15:44
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@AlexChien
AlexChien / gist:4072519
Created November 14, 2012 14:45 — forked from mutru/gist:3505849
config/god/resque.god
rails_env = ENV['RAILS_ENV']
raise "Please specify RAILS_ENV." unless rails_env
rails_root = ENV['RAILS_ROOT'] || File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
RESQUE_PROCESSORS = [
[1, "foo,bar"],
[2, "baz"],
[3, "demo"]
]
@AlexChien
AlexChien / gist:4072518
Created November 14, 2012 14:45 — forked from mutru/gist:3505854
config/god/resque_scheduler.god
rails_env = ENV['RAILS_ENV']
raise "Please specify RAILS_ENV." unless rails_env
rails_root = ENV['RAILS_ROOT'] || File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
God.watch do |w|
w.dir = "#{rails_root}"
w.name = "resque-scheduler"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"RAILS_ENV"=>rails_env, "BUNDLE_GEMFILE"=>"#{rails_root}/Gemfile"}