Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Open.Nat;
namespace ConsoleApplication3
{
class Program
@lontivero
lontivero / Program.cs
Created December 14, 2013 03:43
Shows how to manipulate raw wcf messages per operation.
using System;
using System.IO;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using TinyClient.CustomerService;
@lontivero
lontivero / brainfuck.coffee
Last active July 12, 2016 00:58
My Brainfuck language interpreter in exactly 19 LOC
run=(code, input)->
[dptr, cptr, marks, mem, output, stack]=[0, 0, [], (0 for [1..100]), [], []]
for cmd, pos in code
if cmd is '[' then stack.push(pos)
if cmd is ']' then marks[marks[pos] = stack.pop()]=pos
while cptr < code.length
switch code[cptr]
when '+' then mem[dptr] = mem[dptr] + 1 or 1
@lontivero
lontivero / SchnorSignatureBatchVerification.py
Created July 31, 2018 17:36
Verify schnorr signatures in batch
import hashlib
import binascii
p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F
n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
G = (0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)
def point_add(p1, p2):
if (p1 is None):
return p2
@lontivero
lontivero / Vagrantfile
Created August 2, 2018 18:45
Install VirtaulBox VM with Wasabi Wallet install
require 'fileutils'
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.gui = true
@lontivero
lontivero / wasabi-perf.sh
Created November 26, 2018 03:23
Runs and measure performace
#!/bin/bash
COMPlus_PerfMapEnabled=1 dotnet ~/GitHub/WalletWasabi/WalletWasabi.Gui/bin/Debug/netcoreapp2.1/WalletWasabi.Gui.dll &
sudo perf record -p $! -g
sudo perf script -f | ~/GitHub/FlameGraph/stackcollapse-perf.pl | ~/GitHub/FlameGraph/flamegraph.pl > flame.svg
sudo python -m SimpleHTTPServer 80
@lontivero
lontivero / gist:f1884d4df2fbf1ad06d8cf17cae0bd5d
Last active December 11, 2018 20:34
testmempoolaccept RPC method call
bbcli="bitcoin-cli -regtest -datadir=/home/lontivero/tmp/bitcoind"
miner_address=$($bbcli getnewaddress)
address=$($bbcli getnewaddress)
generated_blocks=$($bbcli generatetoaddress 101 $miner_address)
txid=$($bbcli listunspent | jq '.[].txid')
unsigned_raw_tx=$($bbcli createrawtransaction "[{\"txid\":\"$txid\", \"vout\":0}]" "[{\"$address\":30}]")
$bbcli testmempoolaccept "[\"$unsigned_raw_tx\"]"
@lontivero
lontivero / CountCoinJoins.sh
Created January 5, 2019 06:04
Count Wasabi wallet coinjoins per day
cat wasabi.json | jq '[.address.transactions[] | {"txid":.txid, time:(.time | strftime("%Y-%m-%d"))}] | group_by(.time) | map({"date": .[0].time, "count": length})'
cat wasabi.json | jq -r '[.address.transactions[] | {"txid":.txid, time:(.time | strftime("%Y-%m-%d")) } ] | group_by(.time) | map([.[0].time, length])[] | @csv'
@lontivero
lontivero / dumpheap.sh
Last active January 9, 2019 19:16
Dumps a .NET memory heap
#!/bin/bash
sudo lldb-4.0 -o "process attach -p $1" \
-o "plugin load /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.0/libsosplugin.so" \
-o "sos DumpHeap -stat" \
-o "exit"