View gist:376f2787e89fb456bdc8
☁ ~ geth --identity "LocalMiner" --genesis $chaindir/CustomGenesis.json --rpc --rpcport "8545" --rpccorsdomain "*" --datadir "$chaindir/01" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1467510308 --nat "any" --mine --minerthreads "1"
I0205 11:27:01.206871 19343 database.go:71] Alloted 16MB cache to /Users/lucas/.eth/ebchain/01/chaindata
I0205 11:27:01.210302 19343 database.go:71] Alloted 16MB cache to /Users/lucas/.eth/ebchain/01/dapp
I0205 11:27:01.214214 19343 backend.go:314] Protocol Versions: [63 62 61], Network Id: 1467510308
I0205 11:27:01.214616 19343 genesis.go:89] Genesis block already in chain. Writing canonical number
I0205 11:27:01.214640 19343 backend.go:326] Successfully wrote genesis block. New genesis hash = 27a213a028c685b8017e6b10a30a18008d238857f6f48deee9406d9c4d40d4ac
I0205 11:27:01.214662 19343 backend.go:362] Blockchain DB Version: 3
I0205 11:27:01.215146 19343 blockchain.go:2
View gist:a1a1da1971f5c1c93fc2
Lucas-MacBook-Pro:~ lucas$ sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Lucas/ --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app/
Password:
Ready to start.
To continue we need to erase the disk at /Volumes/Lucas/.
If you wish to continue type (Y) then press return: Y
Erasing Disk: 0%... 10%... 20%... 30%...100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
View admin.peers.txt
[{
caps: ["eth/61", "eth/62", "eth/63"],
id: "1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082",
name: "Geth/v1.3.3-c541b38f/linux/go1.5.1",
network: {
localAddress: "192.168.0.108:54680",
remoteAddress: "52.74.57.123:30303"
},
protocols: {
eth: {
View truncate.css
.truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
View 3des.rb
def encrypted_password(password)
if password.length < 8
password = "#{password}#{'0'*(8-password.length)}"
end
key = "12345678"
secret = "1234567890" + password + "123456"
# des-ede3-cbc Three key triple DES EDE in CBC mode
# des-ede3 Three key triple DES EDE in ECB mode
View paynow_invoice.rb
require 'net/http'
# Create the SOAP Envelope
data = <<-EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetInvoiceNumber xmlns="testinvoice.PayNow.com.tw">
<mem_cid>70828783</mem_cid>
<Year>2015</Year>
View deferred_garbage_collection.rb
class DeferredGarbageCollection
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f
@@last_gc_run = Time.now
def self.start
GC.disable if DEFERRED_GC_THRESHOLD > 0
end
View eval_benchmark.rb
require 'benchmark'
require 'active_support/inflector'
class Foo
def self.bar
end
end
def with_eval
eval "Foo.bar"
View rspec_with_anonymous_controller.rb
require 'rails_helper'
RSpec.describe V1::BaseController, :type => :controller do
before do
Rails.application.routes.draw do
match "/v1/dummy", to: "v1/base#index", via: :all
end
end
View standup
#!/usr/bin/env ruby
require 'date'
def open_video(file)
file = file.gsub(/\s/, '\\ ')
puts "opening #{file}"
`open #{file} -n /Applications/MPlayerX.app`
end