Skip to content

Instantly share code, notes, and snippets.

View siman's full-sized avatar
🏠
Working from home

Alex Siman siman

🏠
Working from home
View GitHub Profile
@siman
siman / ethereum-transfer-events.js
Created October 26, 2017 19:50
JSON output of Transfer events of Golem token, Ethereum
// web3 code for Golem smart contract
// Golem token:
// https://etherscan.io/address/0xa74476443119A942dE498590Fe1f2454d7D4aC0d
// Golem Token tx:
// https://etherscan.io/tx/0x6e8e11e694673b0b9135511a8267ff05a8444af7d88aaf043350e6349fdb9bb0
// Golem creation block:
// 2603185
@siman
siman / litecoin-tx-real-sample-1-input.js
Last active October 26, 2017 20:00
JSON of Litecoin tx 82e7738a7e315f4cdd674d830119bebab4016d1497cf5cc47971bdb75d3d3906
// Run from console (requires Litecoin full node with "txindex=1" in litecoin.conf):
// $ litecoin/bin/litecoin-cli getrawtransaction 82e7738a7e315f4cdd674d830119bebab4016d1497cf5cc47971bdb75d3d3906 1
//
// Where we call method "getrawtransaction" with 2 arguments:
// txid: 82e7738a7e315f4cdd674d830119bebab4016d1497cf5cc47971bdb75d3d3906
// 1 - to decode raw tx
var txJson =
{
"hex": "0100000001679daba376c12e3f6ed7cd72e19d4af98b00d0ad29d66965ea4e39a2a7e0d66e010000006c493046022100b9211248e7741851e583eeb74deba169689f02fa0282c85493b4a018edb34800022100939501466fbb41f7afa0e80c06a0e01443372d5d5f38da0a5faa482aeb1f2e2b0121023d50a25ce5ab515c2b0920ce29bf0facd17ed7d914f7ef6859b0bd91b6c5580effffffff0207d42bb9090000001976a914ac79e1772f994c04dc4bb8dabab1db69625ce64188ac0ba61c0c000000001976a91494139449bb5a7227f238dfa9d777260cf3a7bd8c88ac00000000",
pragma solidity ^0.4.8;
// ----------------------------------------------------------------------------------------------
// A collaboration between Incent and Bok :)
// Enjoy. (c) Incent Loyalty Pty Ltd, and Bok Consulting Pty Ltd 2017. The MIT Licence.
// ----------------------------------------------------------------------------------------------
//config contract
contract TokenConfig {
@siman
siman / jquery-in-browser-console.js
Created April 20, 2017 23:59
Inject jQuery into browser console
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
{
"brand": "Twitch",
"site": "https://www.twitch.tv/",
"logo": "https://www-cdn.jtvnw.net/images/twitch_logo3.jpg",
"market": "Gaming",
"tactic": "Build a UGC community"
},
{
"brand": "Airbnb",
"site": "https://www.airbnb.com/",
@siman
siman / install-scala-2.11.7-sbt-0.13.9-on-ubuntu.sh
Last active November 17, 2015 15:28 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala 2.11.7 and SBT 0.13.9 using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
sudo apt-get update
sudo apt-get install scala
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
@siman
siman / gist:7458258
Created November 13, 2013 23:14
Postgres DAO with Slick (Scala)
package models
import scala.slick.driver.PostgresDriver.simple._
import Database.threadLocalSession
import scala.slick.jdbc.{GetResult, StaticQuery => Q}
trait AbstractDao[Id, E] {
def countAll: Int
@siman
siman / VipTreeApp.scala
Last active December 23, 2015 02:19
Filter VIP nodes of a tree. (non tail-recursive yet)
package example
import collection.mutable.ArrayBuffer
import collection.mutable
import annotation.tailrec
/**
* @author Alex Siman <aleksandr.siman@gmail.com>
* Date: 2013-09-12
*/
abstract class IgnoreIfBusyTyped[C](implicit m: Manifest[C])
extends Actor with ActorLogging {
import context.{become, unbecome}
import context.system
class Completed {
override def toString = "Completed"
}
trait IgnoreIfBusyCmd
abstract class IgnoreIfBusyTyped[C <: IgnoreIfBusyCmd](implicit m: Manifest[C]) extends Actor with ActorLogging{
import context.{become, unbecome}
import context.system
class Completed {
override def toString = "Completed"
}