Skip to content

Instantly share code, notes, and snippets.

@leelakrishna
leelakrishna / camel2underscore.scala
Created June 20, 2020 06:41 — forked from sidharthkuruvila/gist:3154845
Utility to functions to convert between camel case and underscore separated names
/**
* Takes a camel cased identifier name and returns an underscore separated
* name
*
* Example:
* camelToUnderscores("thisIsA1Test") == "this_is_a_1_test"
*/
def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m =>
"_" + m.group(0).toLowerCase()
})
@leelakrishna
leelakrishna / gist:19c65427a3f8b9d07b43c64489868790
Created June 20, 2020 06:41 — forked from sidharthkuruvila/gist:3154845
Utility to functions to convert between camel case and underscore separated names
/**
* Takes a camel cased identifier name and returns an underscore separated
* name
*
* Example:
* camelToUnderscores("thisIsA1Test") == "this_is_a_1_test"
*/
def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m =>
"_" + m.group(0).toLowerCase()
})
@leelakrishna
leelakrishna / punnel.py
Created May 14, 2020 03:33 — forked from shatil/punnel.py
Python OpenSSL libraries' private key signing vs. OpenSSL's rsautl
#!/usr/bin/env python
from __future__ import print_function
import base64
import sys
PEM = ("""-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAgK1Q6Ydi8UUheJLvnTYJE65NOZtAtjDdDSxS+6b4x9EakjIylljSzs5uLEJn
package main
import (
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
)
type Users struct {
Id int `gorm:"AUTO_INCREMENT" form:"id" json:"id"`
@leelakrishna
leelakrishna / introrx.md
Created April 18, 2016 03:40 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@leelakrishna
leelakrishna / stormTopologyCheck.py
Created March 25, 2016 15:39 — forked from wesfloyd/stormTopologyCheck.py
Script runs constantly at X seconds interval checking to see if topologies have stopped processing new Tuples
# Wes Floyd April 2015
import sys
import requests
import json
import argparse
import pprint
import time
pp = pprint.PrettyPrinter(indent=4)
@leelakrishna
leelakrishna / kafka_install.md
Created March 24, 2016 08:34 — forked from leommoore/kafka_install.md
Kafka - Messaging Basics

#Kafka - Messaging Basics This assumes you are starting fresh and have no existing Kafka or ZooKeeper data. See http://kafka.apache.org/documentation.html#quickstart for more details.

##Install Java

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives
Found 0 entries
kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives stats
Can't understand argument: stats
kawasaki@hadoop11:~$ hdfs cacheadmin -listDirectives -stats
Found 0 entries
kawasaki@hadoop11:~$ hadoop fs -ls dir1
Found 4 items
drwxr-xr-x - kawasaki kawasaki 0 2014-04-09 06:38 dir1/a
-rw-r--r-- 3 kawasaki kawasaki 75288655 2014-04-09 06:44 dir1/bigfile
@leelakrishna
leelakrishna / benchmark-commands.txt
Created March 22, 2016 10:47 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
$ kafka-topics --zookeeper localhost:2181 --create --topic test-rep-one -partitions 6 --replication-factor 1
Created topic "test-rep-one".
kafka-producer-perf-test --topic test-rep-one --num-records 50000 --record-size 1000 --throughput 1000 --producer-props acks=-1 bootstrap.servers=$HOSTNAME:9092
5000 records sent, 1000.0 records/sec (0.95 MB/sec), 4.3 ms avg latency, 222.0 max latency.
5005 records sent, 1000.8 records/sec (0.95 MB/sec), 1.6 ms avg latency, 10.0 max latency.
5002 records sent, 1000.2 records/sec (0.95 MB/sec), 1.4 ms avg latency, 23.0 max latency.
5002 records sent, 1000.2 records/sec (0.95 MB/sec), 1.3 ms avg latency, 8.0 max latency.
5001 records sent, 1000.2 records/sec (0.95 MB/sec), 1.2 ms avg latency, 6.0 max latency.
5000 records sent, 1000.0 records/sec (0.95 MB/sec), 1.2 ms avg latency, 5.0 max latency.