Skip to content

Instantly share code, notes, and snippets.

View tinybike's full-sized avatar

Jack Peterson tinybike

  • Merica
View GitHub Profile
@tinybike
tinybike / tensor_transpose.jl
Last active August 29, 2015 14:17
Swap dimensions of 3rd and 4th order tensors
# Swap dimensions of ("transpose") 3rd and 4th order tensors
# @author Jack Peterson (jack@tinybike.net)
function _transpose{T<:Real}(tensor::Array{T,3}, permute::Vector{Int})
shape = size(tensor)
ttensor = zeros(shape)
idx = zeros(3)
for idx[1] = 1:shape[1]
for idx[2] = 1:shape[2]
for idx[3] = 1:shape[3]
(develop) jack@vent:~/src/pyethereum$ pyeth
INFO:app starting version='0.8.52_57_gf6f3b1a-py2.7.egg'
Traceback (most recent call last):
File "/usr/local/bin/pyeth", line 9, in <module>
load_entry_point('pyethereum==0.8.52-57-gf6f3b1a', 'console_scripts', 'pyeth')()
File "/usr/local/lib/python2.7/dist-packages/pyethereum-0.8.52_57_gf6f3b1a-py2.7.egg/pyethereum/eth.py", line 133, in main
config = create_config()
File "/usr/local/lib/python2.7/dist-packages/pyethereum-0.8.52_57_gf6f3b1a-py2.7.egg/pyethereum/eth.py", line 125, in create_config
konfig.validate_config(config)
File "/usr/local/lib/python2.7/dist-packages/pyethereum-0.8.52_57_gf6f3b1a-py2.7.egg/pyethereum/config.py", line 103, in validate_config
@tinybike
tinybike / centering.jl
Created March 17, 2015 20:23
centering matrix
centering(n::Int) = eye(n) - ones(n) * ones(n)' / n
centering{T<:Real}(n::Int, w::Vector{T}) = eye(n) - ones(n) * w'
normalize{T<:Real}(v::Vector{T}) = vec(v) / sum(v)
@tinybike
tinybike / ethrpc.js
Last active August 29, 2015 14:19
send json-rpc commands from your web browser to ethereum
/**
* Send JSON-RPC commands to Ethereum from the safety and convenience of
* your browser!
*
* Examples:
* EthRPC.eth("blockNumber");
* EthRPC.net("peerCount");
*
* @author Jack Peterson (jack@augur.net)
* @date 4/12/2015
@tinybike
tinybike / pp.js
Created April 13, 2015 04:54
pretty print one-liner
function pp(o) { console.log(JSON.stringify(o, null, 2)); }
jack@vent:~$ geth --rpc --mine
Welcome to the FRONTIER
I0413 04:19:40.226359 6092 backend.go:180] Protocol Version: 60, Network Id: 0
I0413 04:19:40.227393 6092 chain_manager.go:186] Last block (#0) fd4af92a79c7fc2fd8bf0d342f2e832e1d4f485c85b9152d2039e03bc604fdca TD=0
I0413 04:19:40.227548 6092 ethash.go:94] Making cache
I0413 04:19:41.486967 6092 ethash.go:99] Took: 1.259391338s
I0413 04:19:41.491780 6092 cmd.go:116] Starting Geth/v0.9.9/linux/go1.4.2
I0413 04:19:41.491884 6092 server.go:170] Starting Server
I0413 04:19:42.342868 6092 nat.go:94] mapping error: no devices discovered
I0413 04:19:42.349954 6092 udp.go:157] Listening, enode://fabdc2ab9d1366af40b7772fad570e92da0e2378f71506fc64d60cdb13e4cf5e4c23c39e30a32a95ee82217a42325bacc746e415a637ae6e56635c29ca111abf@71.215.180.92:30303
-N- [ 00:04:13 | p2p ] Hello: Ethereum(++)/Gav's Node/v0.9.7/Release/linux/g++/int V[ 3 ] bf1d38bb… (eth,60)(shh,2) 30303
-N- [ 00:04:13 | p2p | 0 ] Transition! State from Nothing , holding
*N* [ 00:04:13 | p2p ] p2p.host.peer.register bf1d38bb…
-N- [ 00:04:13 | p2p | 0 ] Status: 60 / 0 / fd4af92a… , TD: 281348177475 = 8074a3ec…
!N! [ 00:04:13 | p2p | 0 ] DISABLE: Disabling capability ' eth '. Reason: Peer banned for previous bad behaviour.
-N- [ 00:04:14 | p2p | 0 ] Status: 2
!N! [ 00:04:15 | p2p ] Disconnecting 92.51.165.126:55525 (Handshake Timeout)
!N! [ 00:04:15 | p2p | -1 ] Error reading: Operation canceled
-N- [ 00:04:15 | p2p | -1 ] Closing Peer Session :-(
-N- [ 00:04:15 | p2p | 0 ] Aborting Sync :-(
@tinybike
tinybike / tallstack.se
Created April 20, 2015 22:03
lol @ stack depth
def f1():
with s0 = 0:
with s1 = 1:
with s2 = 2:
with s3 = 3:
with s4 = 4:
with s5 = 5:
with s6 = 6:
with s7 = 7:
with s8 = 8:
@tinybike
tinybike / test_tallstack.py
Created April 20, 2015 22:08
lol @ stack depth
#!/usr/bin/env python
from pyethereum import tester as t
s = t.state()
t.gas_limit = 100000000
s = t.state()
c = s.abi_contract("contract1.se", gas=70000000)
@tinybike
tinybike / boost_version.cpp
Created April 21, 2015 08:56
check boost version
#include <cstdio>
#include <boost/version.hpp>
int main()
{
printf("Boost version: %d.%d.%d\n", BOOST_VERSION / 100000,
BOOST_VERSION / 100 % 1000,
BOOST_VERSION % 100);
return 0;
}