Skip to content

Instantly share code, notes, and snippets.

View pm47's full-sized avatar

Pierre-Marie Padiou pm47

View GitHub Profile
@pm47
pm47 / eclair-cli.sh
Last active July 26, 2017 15:08
eclair-cli
#!/bin/bash
[ -z "$1" ] && (
echo "usage: "
echo " eclair-cli help"
) && exit 1
URL="http://localhost:8080"
CURL_OPTS="-sS -X POST -H \"Content-Type: application/json\""
eclair.bitcoind.rpcport=8332
eclair.bitcoind.rpcuser = "bitcoinrpc"
eclair.bitcoind.rpcpassword = "XXXXX"
@pm47
pm47 / NewChannel.scala
Last active May 20, 2016 16:32
LN wire protocol simulator
package fr.acinq.protos
import java.io.{BufferedWriter, File, FileWriter}
import akka.actor.{Actor, ActorLogging, ActorRef, ActorSystem, LoggingFSM, Props, Stash}
// @formatter:off
sealed trait NewState
sealed trait NewData
val start = Platform.currentTime
Await.result(expensiveCall(), timeout)
val duration = Platform.currentTime - start
val start = Platform.currentTime
val future = expensiveCall()
future.onComplete {
case Success(s) => {
val duration = Platform.currentTime - start
...
@pm47
pm47 / gist:5262372
Created March 28, 2013 11:03
duration of a future
val start = Platform.currentTime
val future = ...
future.onComplete {
case Success(s) => {
val duration = Platform.currentTime - start
...
}
case Failure(t) => ...
}
@pm47
pm47 / gist:4595698
Created January 22, 2013 15:48
test
zselect * from balhc where toto = '10001365268'
select * from balhc where toto = '1,00014E+11'
select * from balhc where toto = '1,00015E+11'
select * from balhc where toto = '1,00016E+11'
select * from balhc where toto = '1,00016E+11'
select * from balhc where toto = '1,00016E+11'
select * from balhc where toto = '1,00016E+11'
select * from balhc where toto = '1,00017E+11'
select * from balhc where toto = '1,00017E+11'
select * from balhc where toto = '1,00018E+11'
@pm47
pm47 / gist:4174914
Created November 30, 2012 10:07
basic ec2 spot instance
package com.mfglabs.jclouds
import org.jclouds.compute.ComputeServiceContext
import scala.collection.JavaConversions._
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule
import org.jclouds.ContextBuilder
import org.jclouds.ec2.domain.InstanceType
import org.jclouds.predicates.{InetSocketAddressConnect, RetryablePredicate}
import java.util.concurrent.TimeUnit
import com.google.common.net.HostAndPort
@pm47
pm47 / gist:4071789
Created November 14, 2012 12:14
mutator
package contrib.curator;
import com.netflix.curator.framework.CuratorFramework;
import com.netflix.curator.framework.CuratorFrameworkFactory;
import com.netflix.curator.retry.ExponentialBackoffRetry;
import com.netflix.curator.test.TestingServer;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import java.io.IOException;
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade