Skip to content

Instantly share code, notes, and snippets.

View kaustavha's full-sized avatar
:octocat:
:electron: :atom: :shipit: 🚀 🌟 🇮🇳 🇺🇸 🇨🇦 Ethereum fanboi

Kaustav Haldar kaustavha

:octocat:
:electron: :atom: :shipit: 🚀 🌟 🇮🇳 🇺🇸 🇨🇦 Ethereum fanboi
View GitHub Profile
@kaustavha
kaustavha / README.md
Created February 20, 2016 00:06
Kafka pixy kafka consumer benchmarks

This is code used to benchmark throughput using the kafka-pixy kafka client.

Setup:

curl -L https://github.com/mailgun/kafka-pixy/releases/download/v0.10.1/kafka-pixy-v0.10.1-linux-amd64.tar.gz | tar xz
cd kafka-pixy-v0.10.1-linux-amd64
./kafka-pixy --kafkaPeers "localhost:9092", --zookeeperPeers "localhost:2181"

Usage:

@kaustavha
kaustavha / logstash.conf
Last active February 20, 2016 00:20
Logstash kafka benchmark
input {
kafka {
topic_id => 'observations.json'
zk_connect => 'localhost:2181'
type => 'kafka'
auto_offset_reset => 'smallest'
consumer_threads => 12
codec => 'snappy'
}
}
@kaustavha
kaustavha / README.md
Created February 20, 2016 00:27
Kafka Go benchmarks

You'll need a version of Go >1.3 since Sarama will fail to compile on anything below that. also remember to install sarama using go get github.com/Shopify/sarama and finally build the binary.

Usage:

./warehouser -zookeeper "localhost:2181"

Results:

@kaustavha
kaustavha / ethere.txt
Created June 29, 2017 23:13
0xB64762d24e24a27468ab09aA0D19244a2832e893
0xB64762d24e24a27468ab09aA0D19244a2832e893
@kaustavha
kaustavha / README.md
Last active September 28, 2017 15:48
Ethereum waterloo meetup 2 F17 - setup instructions

Pre-setup:

  • Install nodejs, npm, git

Setup:

  • Install the meta-mask chrome extension: https://metamask.io/
  • For part1: git clone https://github.com/kaustavha/learn_eth.git && cd learn_eth && npm install
  • For part2: npm install -g truffle ethereumjs-testrpc && mkdir pet-shop-tutorial && cd pet-shop-tutorial && truffle unbox pet-shop

Links:

@kaustavha
kaustavha / a.txt
Last active September 28, 2017 23:28
0xB64762d24e24a27468ab09aA0D19244a2832e893
@kaustavha
kaustavha / speedup.md
Last active November 16, 2025 23:50
Increase playback speed on any video
document.querySelector('video').playbackRate = 1.5
  • Videos on any page using a video tag. Youtube, vimeo etc

  • (Right click/2 finger click on mac -> inspect element); on the video to reveal the <video></video> tag, otherwise you might get a var v = document.querySelector('video'); var t = prompt('Set the playback rate'); v.playbackRate = parseFloat(t) err.

  • Paste this into the console (go to console from the window that pops up from inspect element or cmd + option + i):

@kaustavha
kaustavha / github.js
Created June 28, 2018 20:31
Github browser helper
// Get a list of all the names of all the projects on a github org page
s = [];
document.querySelectorAll('.col-12').forEach(e => {x = e.firstChild.nextSibling.firstChild.nextSibling.innerText; s.push(x.replace(' Private', ''))});
// Break the list into lines to easily copy paste into a spreadsheet
s.forEach(e => console.log(e));
@kaustavha
kaustavha / deleteDupFilesInDirectory.js
Last active February 24, 2019 19:27
Delete all duplicate files in mac
// cd to the dir// or open a iterm window - rclick , new console/iterm2
// > node
let arr = fs.readdirSync('.'), dupcheck = [], outarr = [],
add = a => a[0] + a[1];
arr.forEach(i => {
if (i.split(' ').length > 1) {
if (dupcheck.indexOf(add(i.split(' '))) !== -1) {
outarr.push(i.split(' '));
}
@kaustavha
kaustavha / objToArr.js
Created October 8, 2019 02:05
Javascript - turn array with negative indices to normal array
/**
* Returns a normal iterable array from an array with -ve numbers, padding any missing elements with the provided filler
* Use case - algo problems where we move in 2d space to -ve numbered places in an arr or matrix
* @param {Array} obj An array containing -ve numbers as indices, behaves like an object at times
* @param {*} filler Filler material to populate missing members e.g. array or string
* @param {Number} maxPos maximum positive value of a key in array
* @param {Number} maxNeg max -ve value of a key in the incoming array
* @returns {Array} Sorted array
*/
function _objToArr(obj, filler, maxPos, maxNeg) {