Skip to content

Instantly share code, notes, and snippets.

View zippy's full-sized avatar

Eric Harris-Braun zippy

View GitHub Profile
@zippy
zippy / gist:1276936
Created October 11, 2011 00:13
clojurescript and goog.ui.select
(defn make-select [elem-id]
(let [select (goog.ui.Select. "Heading")
select-elem (d/element (keyword (str "div#" elem-id)))]
(.addItemAt select (goog.ui.MenuItem. "Item 1") 0)
(.addItem select (goog.ui.Option. "Item 2"))
(.render select select-elem)
select-elem
)
)
@zippy
zippy / adding shuffle to vector
Created September 19, 2013 01:06
Failed attempt to add shuffle to Rust vec
pub trait MutableVector<'self, T> {
fn shuffle(self);
}
impl<'self, T> MutableVector<'self, T> for &'self mut [T] {
fn shuffle(self) {
let l=self.len();
let mut i=l;
let mut rng = rand::rng();
loop {
//run system commands
#include <stdio.h>
char *doSys(char *cmd) {
FILE *pipe = popen(cmd, "r");
if (!pipe) {return "err"; }
int sz = 1000;
int remaining = sz;
char *buffer = malloc(sz);
char buf[255];
while (fgets(buf, 255, pipe) != NULL) {
go get github.com/libp2p/go-libp2p-swarm
# github.com/libp2p/go-libp2p-conn
../../libp2p/go-libp2p-conn/dial.go:134: cannot use pconn (type transport.Conn) as type conn.Conn in assignment:
transport.Conn does not implement conn.Conn (missing ID method)
../../libp2p/go-libp2p-conn/listen.go:104: cannot use pc (type transport.Conn) as type conn.Conn in assignment:
transport.Conn does not implement conn.Conn (missing ID method)
@zippy
zippy / make-test-failing
Created March 12, 2017 15:26
failing make test
eric@finkomatic:~/go/src/github.com/metacurrency/holochain$ make test
gx install --global
installation of dep go-semver complete!
installation of dep dns complete!
installation of dep go-text complete!
installation of dep go-net complete!
installation of dep mdns complete!
installation of dep go-randbuf complete!
installation of dep go-msgio complete!
installation of dep go-crypto complete!
npm test
> [email protected] test /home/eric/code/metacurrency/hc-scaffold
> standard && node ./bin/build.js && ninja && node ./bin/exec-tests.js
wrote build.ninja
build - Transpiles source files to ECMAScript 5 before publishing.
lint - Verifies source code meets syntax/style rules.
ls - Lists dependencies (top-level).
outdated - Lists outdated dependencies (top-level).
$ go test
# github.com/libp2p/go-libp2p-metrics/conn
../../libp2p/go-libp2p-metrics/conn/conn.go:28: mc.Conn.Read undefined (type transport.Conn has no field or method Read)
../../libp2p/go-libp2p-metrics/conn/conn.go:35: mc.Conn.Write undefined (type transport.Conn has no field or method Write)
# github.com/libp2p/go-libp2p-conn
../../libp2p/go-libp2p-conn/conn.go:90: c.maconn.SetDeadline undefined (type transport.Conn has no field or method SetDeadline)
../../libp2p/go-libp2p-conn/conn.go:93: c.maconn.SetReadDeadline undefined (type transport.Conn has no field or method SetReadDeadline)
../../libp2p/go-libp2p-conn/conn.go:97: c.maconn.SetWriteDeadline undefined (type transport.Conn has no field or method SetWriteDeadline)
../../libp2p/go-libp2p-conn/conn.go:126: c.maconn.Read undefined (type transport.Conn has no field or method Read)
../../libp2p/go-libp2p-conn/conn.go:126: not enough arguments to return
go test
# github.com/metacurrency/holochain
./node.go:367: cannot use []"gx/ipfs/QmXY77cVe7rVRQXZZQRioukUM7aRW3BTcAgJe12MCtb3Ji/go-multiaddr".Multiaddr literal (type []"gx/ipfs/QmXY77cVe7rVRQXZZQRioukUM7aRW3BTcAgJe12MCtb3Ji/go-multiaddr".Multiaddr) as type []"github.com/multiformats/go-multiaddr".Multiaddr in argument to swarm.NewNetwork
./node.go:367: cannot use nodeID (type "gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer".ID) as type "github.com/libp2p/go-libp2p-peer".ID in argument to swarm.NewNetwork
./node.go:367: cannot use ps (type "gx/ipfs/QmPgDWmTmuzvP7QE5zwo1TmjbJme9pmZHNujB2453jkCTr/go-libp2p-peerstore".Peerstore) as type "github.com/libp2p/go-libp2p-peerstore".Peerstore in argument to swarm.NewNetwork:
"gx/ipfs/QmPgDWmTmuzvP7QE5zwo1TmjbJme9pmZHNujB2453jkCTr/go-libp2p-peerstore".Peerstore does not implement "github.com/libp2p/go-libp2p-peerstore".Peerstore (wrong type for AddAddr method)
have AddAddr("gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer".
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! IMMORTAL LOCK GUARD FOUND !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Read guard puid-52-2d36 lived for > 60 seconds. Backtrace at the moment of guard creation follows:
stack backtrace:
0: holochain_core_types::sync::GuardTracker::new::hd56bcfce9f7e9113 (0x55b9093deb20)
1: holochain_core_types::sync::HcRwLockReadGuard<T>::new::hcd844ea0979f8319 (0x55b9089d8982)
2: holochain_core_types::sync::HcRwLock<T>::try_read::hbdc6f3f091813dc4 (0x55b9089d806b)
★ ERROR 2019-11-04 09:42:20 [holochain_core_types::sync] hc_guard_watcher/puid-0-0 crates/core_types/src/sync.rs:121
★ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
★ !!! IMMORTAL LOCK GUARD FOUND !!!
★ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
★ Lock guard puid-0-a2 lived for > 60 seconds.
★ Backtrace at the moment of guard creation follows:
★ stack backtrace: