Skip to content

Instantly share code, notes, and snippets.

View adarshaj's full-sized avatar

Adarsh J adarshaj

View GitHub Profile
@adarshaj
adarshaj / reflect-extract-ctor-args.scala
Created April 7, 2020 14:47 — forked from heathermiller/reflect-extract-ctor-args.scala
Getting constructor arguments out of a case class, printing the names of the args and their runtime values
import scala.reflect.runtime.universe._
class AbstractParams[T: TypeTag] {
def tag: TypeTag[T] = typeTag[T]
override def toString: String = {
// Find all case class fields in concrete class instance and print them as "[field name] [field value]"
val tag = this.tag
val tpe = tag.tpe
val allAccessors = tpe.declarations.collect { case meth: MethodSymbol if meth.isCaseAccessor => meth }
@adarshaj
adarshaj / service-checklist.md
Created March 14, 2018 16:24 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?

Keybase proof

I hereby claim:

  • I am adarshaj on github.
  • I am adarshaj (https://keybase.io/adarshaj) on keybase.
  • I have a public key ASBC7i-2GWZHiz5LsmGMH2zfepGizjtjAQpPD7V3P9g_BAo

To claim this, I am signing this object:

@adarshaj
adarshaj / gist:6b80c744cede23255306
Created November 28, 2015 17:05 — forked from greggyNapalm/gist:2282242
TCP/IP stack linux
# increase system IP port limits
net.ipv4.ip_local_port_range=1024 65535
# Incoming packets queue length
net.core.netdev_max_backlog=10000
# TCP socket max connections num
net.core.somaxconn=262144
# Enable syncookies
hashtag = (function () {
// Twitter's official hashtag verifier.
// Ported from https://github.com/twitter/twitter-text-rb/blob/master/lib/twitter-text/regex.rb
// Creates a Unicode Regular Expression range
function regexRange (from, to) {
to = to || 0;
from = from.toString(16);
fromLen = (from.length > 4) ? from.length : 4;
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is