Skip to content

Instantly share code, notes, and snippets.

Avatar

Derek Chiang derekchiang

View GitHub Profile
View truffle.js
let HDWalletProvider = require('truffle-hdwallet-provider')
let { mnemonic, infuraKey } = require('./credentials.json')
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
//
networks: {
development: {
host: "localhost",
@derekchiang
derekchiang / app.html
Last active Oct 24, 2020 — forked from bellbind/app.html
[electron]Use electron as a Web Server
View app.html
<!doctype html>
<html><head><script src="app.js"></script></head><body></body></html>
View options.go
package main
import "fmt"
// WithPrefix
type prefixOption struct{}
func WithPrefix() interface {
GetOption
View gist:fe9033a45b07f8f717daa070187374a6
#!/usr/bin/env bash
apt-get -y install postgresql-9.4 postgresql-contrib-9.4 postgresql-server-dev-9.4
###########################################
# Hack alert:
# For Postgresql 9.4, pg_rewind is not in the main source tree and
# no packages exist in the repos, so it must be compiled manually
# and installed on the image until we can move to 9.5
# See README at
View gist:ddd7c7b90f749511be414d879655d4f3
goroutine profile: total 557
75 @ 0x42c78a 0x43b964 0x43a5cc 0x7dbe7f 0x458e71
# 0x7dbe7e github.com/pachyderm/pachyderm/src/server/vendor/google.golang.org/grpc.newClientStream.func3+0x40e /go/src/github.com/pachyderm/pachyderm/src/server/vendor/google.golang.org/grpc/stream.go:236
62 @ 0x42c78a 0x43b964 0x43a5cc 0x162cf26 0x458e71
# 0x162cf25 github.com/pachyderm/pachyderm/src/server/vendor/github.com/coreos/etcd/clientv3.(*watchGrpcStream).serveSubstream+0x525 /go/src/github.com/pachyderm/pachyderm/src/server/vendor/github.com/coreos/etcd/clientv3/watch.go:591
53 @ 0x42c78a 0x43b964 0x43a5cc 0x162c377 0x458e71
# 0x162c376 github.com/pachyderm/pachyderm/src/server/vendor/github.com/coreos/etcd/clientv3.(*watchGrpcStream).run+0x15b6 /go/src/github.com/pachyderm/pachyderm/src/server/vendor/github.com/coreos/etcd/clientv3/watch.go:421
View gist:dce74806fe06b836f910183c9ad6a3a1
heap profile: 6: 21725184 [83739: 44860896] @ heap/1048576
2: 20971520 [2: 20971520] @ 0x87f70f 0x1660812 0x866d83 0x7d3649 0x7d4c3d 0x7da5f9 0x458e71
# 0x87f70e github.com/pachyderm/pachyderm/src/server/vendor/github.com/pachyderm/pachyderm/src/client/pkg/grpcutil.WriteToStreamingBytesServer+0x8e /go/src/github.com/pachyderm/pachyderm/src/server/vendor/github.com/pachyderm/pachyderm/src/client/pkg/grpcutil/stream.go:72
# 0x1660811 github.com/pachyderm/pachyderm/src/server/pfs/server.(*localBlockAPIServer).GetObject+0x181 /go/src/github.com/pachyderm/pachyderm/src/server/pfs/server/local_block_api_server.go:99
# 0x866d82 github.com/pachyderm/pachyderm/src/server/vendor/github.com/pachyderm/pachyderm/src/client/pfs._ObjectAPI_GetObject_Handler+0x112 /go/src/github.com/pachyderm/pachyderm/src/server/vendor/github.com/pachyderm/pachyderm/src/client/pfs/pfs.pb.go:2458
# 0x7d3648 github.com/pachyderm/pachyderm/src/server/vendor/google.golang.org/grpc.(*Server).processStreamingRPC+0x7b8 /go/src/github.co
View mesos-simulator-usage.md

Usage

  1. Compile this Mesos fork like you normally would.

Notice that we are currently on the custom-exec branch.

  1. Set the environment variable MESOS_DEFAULT_EXECUTOR_PATH to $BUILD_DIR/src/mesos-simexecutor

BUILD_DIR is your build directory.

View generator.c
#include <stdio.h>
// A generator that generates 0..10 infinitely
int generator(void) {
static int i, state = 0;
switch (state) {
case 0: goto LABEL0;
case 1: goto LABEL1;
}
View gist:10350391

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses.

https://github.com/NICTA/course/ this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. (Thanks bos!)

@derekchiang
derekchiang / native_bench.rs
Created Feb 14, 2014
A benchmark of Rust libnative.
View native_bench.rs
extern mod native;
extern mod extra;
extern mod sync;
use sync::mutex::{StaticMutex, MUTEX_INIT};
use std::os;
static mut LOCK: StaticMutex = MUTEX_INIT;
#[start]
fn start(argc: int, argv: **u8) -> int {
You can’t perform that action at this time.