Skip to content

Instantly share code, notes, and snippets.

@ldub
ldub / 01_num_shielded_txs.sql
Last active June 5, 2019 05:04
zcash-shielded-transaction-censorship
-- counts the number of shielded zcash transactions sent between 2019-01-01 to 2019-05-29
SELECT COUNT(*) AS num_shielded_txs FROM `bigquery-public-data.crypto_zcash.transactions` AS zec_txs
WHERE
zec_txs.is_coinbase = FALSE
AND zec_txs.block_timestamp >= '2019-01-01'
AND zec_txs.block_timestamp <= '2019-05-29'
AND (zec_txs.input_count = 0
OR zec_txs.output_count = 0
OR EXISTS (SELECT 1 FROM UNNEST(zec_txs.inputs) WHERE type = 'shielded')
OR EXISTS (SELECT 1 FROM UNNEST(zec_txs.outputs) WHERE type = 'shielded'))
@ldub
ldub / account_takeover.md
Last active November 21, 2019 21:49
Smarx Capture The Ether

first two transactions from 0x6B477781b0e68031109f21887e6B5afEAaEB002b:

  1. 0xd79fc80e7b787802602f3317b7fe67765c14a7d40c3e0dcb266e63657f8813961
  2. 0x061bf0b4b5fdb64ac475795e9bc5a3978f985919ce6747ce2cfbbcaccaf51009

lets ask infura for more information...

λ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x061bf0b4b5fdb64ac475795e9bc5a3978f985919ce6747ce2cfbbcaccaf51009"],"id":1}' https://ropsten.infura.io/v3/

{
    "jsonrpc": "2.0",
@ldub
ldub / keybase.md
Last active November 21, 2019 21:46
Keybase Proof

Keybase proof

I hereby claim:

  • I am ldub on github.
  • I am dubinets (https://keybase.io/dubinets) on keybase.
  • I have a public key ASCFyLfBTpZFU_Iihxb402Mnse-EZHIF63q9ECfh_SJNMAo

To claim this, I am signing this object:

@ldub
ldub / transpose.linq.cs
Created August 22, 2015 01:36
Unzip and Transpose in C# LINQ
// Transpose does this
// {1, 2, 3, 4} {1, 5, 9}
// {5, 6, 7, 8} ==> {2, 6, 10}
// {9,10,11,12} {3, 7, 11}
// {4, 8, 12}
void Main()
{
List<List<int>> list = new List<List<int>>() {
new List<int>() {1, 2, 3, 4},
new List<int>() {5, 6, 7, 8},
@ldub
ldub / Shuffle.java
Last active August 29, 2015 14:16
ShuffleOneLine
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Shuffle {
public static void main(String[] args) {
String str = "shuf_ftw";
try {
String shuffled = (new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(new String[] { "sh", "-c", "echo " + str + " | fold -w1 | shuf | tr -d '\n'" }).getInputStream()))).readLine();
System.out.println(shuffled);
@ldub
ldub / Haskell Challenge
Last active August 29, 2015 14:14
A cool challenge in haskell
This is an excersize in point-free Haskell.
To create a function that adds two numbers we could write:
λ> let f a b = a + b
Or alternatively
λ> let f = (+)
Now, how about a function that adds three numbers?
λ> let g = (+) . (+) --Doesn't work
@ldub
ldub / circleproblem.txt
Last active January 3, 2016 18:29
Cool Problem
Given an array of N points in a plane, find the circle which contains the maximum numbers of the given points on its perimiter.
for each pair of points { // O(N^2)
for each of the N-2 remaining points { // O(N)
compute radius and center of circle defined by the 3 chosen points
}
sort list by radius // O(N*log(N))
filter list by (most common radius) and (most common center) // O(N) ? is it O(N)?
return (radius, center x, center y, number of matching circles);
}