Skip to content

Instantly share code, notes, and snippets.

View rounakdatta's full-sized avatar
💭
roses are sunny, noses are runny

Rounak Datta rounakdatta

💭
roses are sunny, noses are runny
View GitHub Profile
1. Ask HN: What books changed the way you think about almost everything? - https://news.ycombinator.com/item?id=19087418
2. Ask HN: What are the best MOOCs you've taken? - https://news.ycombinator.com/item?id=16745042
3. Ask HN: How to self-learn electronics? - https://news.ycombinator.com/item?id=16775744
4. Ask HN: Successful one-person online businesses? - https://news.ycombinator.com/item?id=21332072
5. Ask HN: What's the most valuable thing you can learn in an hour? - https://news.ycombinator.com/item?id=21581361
@seanh
seanh / bw-open
Last active April 15, 2025 00:48
Log in and unlock your Bitwarden vault (shell script)
#!/usr/bin/env sh
#
# Log in to and unlock Bitwarden CLI.
#
# If you save the returned session key in a BW_SESSION envvar that will unlock
# your Bitwarden vault for the current shell session. Once BW_SESSION has been
# set in one shell session it'll also be inherited by any commands or scripts
# run from that shell session.
#
# Usage (sh):
@unstppbl
unstppbl / go_time_parsing.md
Last active September 23, 2024 07:10
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@kush789
kush789 / testBlocked.command
Last active May 25, 2021 19:24
Using OpenSSL, we attempt to establish a TLS 1.3 connection with 216.58.196.174, corresponding to google.com. However, instead of specifying 'google.com' in the SNI, we specify a potentially blocked website '1337x.be' and an unblocked website 'facebook.com'.
openssl s_client -state -connect 216.58.196.174:443 -servername 1337x.be -tls1_3
@brasey
brasey / Configure systemd-resolved to use a specific DNS nameserver for a given domain.md
Created October 25, 2019 14:38
Configure systemd-resolved to use a specific DNS nameserver for a given domain

Configure systemd-resolved to use a specific DNS nameserver for a given domain

Use case

Given

  • I use a VPN to connect to my work network
  • I'm on a Linux computer that uses systemd-resolved
  • I have a work domain called example.com
  • example.com is hosted by both public and private DNS nameservers
@kiwiandroiddev
kiwiandroiddev / CartesianProduct.kt
Created August 23, 2019 01:58
Kotlin function to return the cartesian product of two collections
/**
* E.g.
* cartesianProduct(listOf(1, 2, 3), listOf(true, false)) returns
* [(1, true), (1, false), (2, true), (2, false), (3, true), (3, false)]
*/
fun <T, U> cartesianProduct(c1: Collection<T>, c2: Collection<U>): List<Pair<T, U>> {
return c1.flatMap { lhsElem -> c2.map { rhsElem -> lhsElem to rhsElem } }
}
@padilo
padilo / kafka-consumer-by-topic.sh
Created July 3, 2019 13:22
Script to get from Kakfa the list of topics consumed by each consumer group
#!/bin/bash
if [ $# -ne 2 ]; then
>&2 echo "usage: $0 <kafka_binary_folder> <bootstrap.server>"
>&2 echo
>&2 echo "It outputs the list of topics consumed by consumergroup as csv."
>&2 echo "With the following structure:"
>&2 echo " <consumer>,<topic>"
exit 1
fi

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

import kotlin.reflect.KSuspendFunction1 // You have to import this manually
import kotlin.reflect.KSuspendFunction2 // You have to import this manually
inline suspend fun <reified Service: RetroService, Result> doSuspendedApiCall(
services: List<RetroService>,
apiCall: KSuspendFunction1<Service, Result>
): Result? {
// identical to doApiCall
}