Skip to content

Instantly share code, notes, and snippets.

@palmerlao
palmerlao / find_geth_peers.py
Created November 3, 2021 06:05
Learn about your geth peers via their IP address
import json
import sys
import time
import requests
# List the peers using admin namespace
peers = requests.post(
"http://localhost:8545",
headers={"Content-Type": "application/json"},
@palmerlao
palmerlao / keybase.md
Created September 17, 2019 05:58
keybase proof

Keybase proof

I hereby claim:

  • I am palmerlao on github.
  • I am palmerlao (https://keybase.io/palmerlao) on keybase.
  • I have a public key ASADLD4zoe8AcI7W0Gwqxb5qFFu6ffq3OdvEyGvPAIxl7wo

To claim this, I am signing this object:

import shapeless._
import ops.record._
import ops.hlist.Tupler
import test.illTyped
import syntax.singleton._
case class Person(name: String, street: String, age: Integer)
object GetFields {
case class Player(name: String, cards: List[Int], points: Int) {
def contains(card: Int): Boolean = cards.contains(card)
def isEmpty: Boolean = cards.isEmpty
override def toString: String = name + ":" + cards.mkString + ":" + points
}
case class GameTree(g: GameState, nexts: List[GameTree]) {
def prettyHelper(pad: String): String =
pad + g + "\n" + nexts.map(_.prettyHelper(" " + pad)).mkString("\n")
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Csv (HasHeader(NoHeader))
import Data.Csv.HMatrix (decodeMatrix)
import qualified Data.ByteString.Lazy as BSL (fromStrict)
import qualified Data.ByteString.Char8 as C (readFile)
// needs dependency "org.scala-lang" % "scala-reflect" % "2.10.6"
object TypeTagExperiment {
import scala.reflect.runtime.universe._
type Vector = (Int, Int)
type Pear = (Int, Int)
val testVector: Vector = (1,1)
val testPear: Pear = (1,1)
import org.scalacheck.Gen
import shapeless._
def gpi: Gen[Integer] = Gen.posNum[Int] map (new Integer(_))
def gpd: Gen[Double] = Gen.posNum[Double]
def gn[A <: AnyRef]: Gen[A] = Gen.const(null.asInstanceOf[A])
def genZipHList[A <: HList , B](g1: Gen[A], g2: Gen[B]): Gen[B :: A] =
for {