Skip to content

Instantly share code, notes, and snippets.

View prayagupa's full-sized avatar
💭
Neta

Prayag prayagupa

💭
Neta
View GitHub Profile
@prayagupa
prayagupa / awake.ps1
Created November 1, 2022 17:59
powershell, awake
clear host
# https://cloudrun.co.uk/powershell/how-to-keep-your-screen-alive-or-pc-from-going-to-sleep-during-presentations/
# Script to keep the PC alive, will prevent screen lock and sleep.
# Works by pressing Print Screen every 2 minutes, side effect is that a screenshot will overwrite the clipboard contents
#
write-warning "I am out for lunch."
Do {
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.SendKeys]::SendWait("{F1}")
@prayagupa
prayagupa / unparsers.scala
Created October 12, 2018 03:49 — forked from ehoner/unparsers.scala
WIP: This is a translation of the examples in haskell to scala through section 4.2.
// script can be loaded by ammonite (http://ammonite.io/)
import $plugin.$ivy.`org.spire-math::kind-projector:0.9.6`
import $ivy.`org.scalaz::scalaz-core:7.2.25`
import scalaz._
import Scalaz._
import scalaz.Maybe.Just
import scala.language.higherKinds
@prayagupa
prayagupa / learnyouerlang.md
Last active December 26, 2017 00:40
learnyousomeerlang, erlang

installation

brew install erlang

Tuple datastructure

@prayagupa
prayagupa / TLS_Tutorial_Copy.md
Last active September 1, 2017 17:05 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@prayagupa
prayagupa / TLS.md
Last active September 12, 2017 18:29
TLS, https, tomcat, p12

Server cert

private key

openssl genrsa -out restapi.key 2048                                                                   

Cert Signing Request

@prayagupa
prayagupa / certificateKeytool.txt
Created August 25, 2017 21:59 — forked from dahernan/certificateKeytool.txt
generate self signed certificate with keytool
To generate a self-signed SSL certificate using the keytool command on Windows, Mac, or Linux:
1 Open a command prompt or terminal.
2 Run this command:
keytool -genkey -keyalg RSA -alias tomcat -keystore selfsigned.jks -validity <days> -keysize 2048
Where <days> indicate the number of days for which the certificate will be valid.
3 Enter a password for the keystore. Note this password as you require this for configuring the server.
@prayagupa
prayagupa / kinesis.py
Last active November 19, 2017 04:12
python
# http://boto3.readthedocs.io/en/latest/reference/services/kinesis.html
import boto3
import json
client = boto3.client('kinesis')
create_stream = client.create_stream(StreamName='GregorSamsa', ShardCount=150)
streams = client.list_streams(Limit=100)
@prayagupa
prayagupa / JSONObject.scala
Last active February 16, 2017 09:41
scala
import scala.util.parsing.json.JSONObject
/**
* Created by prayagupd
* on 2/16/17.
*/
object Test {
@prayagupa
prayagupa / benchmark-commands.txt
Created February 12, 2017 11:31 — 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