Skip to content

Instantly share code, notes, and snippets.

{
identity: <serviceaddr>, // multikey
api: {
location: [
/ip4/123.234.123.234/tcp/80/,
/ipfs/<identity>/tcp/80/
],
import web3.RequestManager
import web3.IBAN
import web3.methods.Eth
import web3.methods.Db
import web3.methods.Shh
import web3.methods.Net
import web3.Personal
import web3.Settings
import version
import utils.utils
@void4
void4 / every.py
Created April 1, 2017 22:04
Python, Time, Interval, __bool__, __nonzero__
# Object which is true once after <interval> seconds
# For Python2, use the __nonzero__ method
class Every:
def __init__(self, interval):
self.interval = interval
self.lasttime = time()
def __bool__(self):
current = time()
if current-self.lasttime>=self.interval:
/*To control the rover, copy and paste the code below into the Arduino software*/
int E1 = 6; //M1 Speed Control
int E2 = 5; //M2 Speed Control
int M1 = 8; //M1 Direction Control
int M2 = 7; //M2 Direction Control
void setup(void)
{
int i;
for(i=5;i<=8;i++)
```
{
"image": {},
"moderates_for": [],
"moderators": [],
"new_robot_id": "67146952",
"robots": [
{
"__v": 9,
"_id": "595b611e9a42c53364befa89",
import json
import requests
username = ""
password = ""
customui = """
[
{
"button_panels": [
@void4
void4 / odicts.py
Last active October 26, 2017 23:41
from collections import OrderedDict
# Allows for dot dict access, but is also ordered (but not nested yet)
# Evil hack 1 from
#https://stackoverflow.com/questions/2352181/how-to-use-a-dot-to-access-members-of-dictionary
class OrderedAttributeDict(OrderedDict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
primitives = {
"+" : sum
}
def step(program):
# For convenience, not necessity
program[0][1] = dict(program[0][1])
class X:
def __init__(self, l=[]):
self.l = l
a,b = X(), X()
print(id(a.l), id(b.l))
a.l.append(1)
print(b.l)
def step(processbinary):
process = decode(processbinary)
if process.instruction == RUN:
if childStillHasResources():
child = process.memory[process.currentsandbox]
child = step(child)
else:
child.state = OUTOFRESOURCES
else: