Skip to content

Instantly share code, notes, and snippets.

pong_c = None
ping_c = None
def ping():
i = 0
while True:
res = yield
print(res)
i += 1
pong_c.send("ping")
@mikeplavsky
mikeplavsky / filter.js
Created November 4, 2018 20:35
get all transactions
var filter = eth.filter({fromBlock:0, toBlock:'latest', address: "0x.."});
filter.get(function (err, transactions) {
transactions.forEach(function (tx) {
var txInfo = eth.getTransactionReceipt(tx.transactionHash);
/* Here you have
txInfo.contractAddress;
txInfo.from;
txInfo.input;
*/
});
@mikeplavsky
mikeplavsky / coin.sol
Last active November 3, 2018 18:18
coin.sol
pragma solidity ^0.4.0;
contract Coin {
address public minter;
mapping(address => uint) public ballances;
constructor() {
minter = msg.sender;
}
@mikeplavsky
mikeplavsky / storage.sol
Last active November 4, 2018 20:43
storage.sol
pragma solidity ^0.4.0;
contract Storage {
int256 v;
constructor (int256 i) {
v = i;
}
@mikeplavsky
mikeplavsky / reduce.py
Last active February 4, 2019 13:29
question1.py
reduce(lambda acc, x: [*acc, x], range(3,9), [10,11,12])
@mikeplavsky
mikeplavsky / runner.go
Last active August 30, 2018 09:13
go question
package main
import (
"fmt"
)
func runner(tasks []int, workers int, f func(int) int) {
in, out := make(chan int), make(chan int)
@mikeplavsky
mikeplavsky / go_question.go
Last active September 25, 2018 15:09
go_question.go
//https://play.golang.org/p/GWkvlW7O2_q
package main
import (
"fmt"
)
func main() {
w := make(chan int)
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: shell
image: centos:7
command:
- "bin/bash"
def f(L):
if L == []:
return []
pivot = L[0]
return ( f([x for x in L[1:] if x < pivot]) + [pivot] + f([x for x in L[1:] if x >= pivot]) )
$PSVersionTable
Set-PSDebug -Trace 2 -Strict
$ErrorActionPreference = "Stop"
$opts = [System.Management.Automation.Remoting.PSSessionOption]::new()
$opts.OutputBufferingMode="Drop"
$creds = Get-Credentials