Skip to content

Instantly share code, notes, and snippets.

def findAvailablePort(): Int = {
val socket = new ServerSocket(0)
val port = socket.getLocalPort
kapkaev / Slug.scala
Created August 4, 2017 17:17 — forked from sam/Slug.scala
package util
object Slug {
def apply(input:String) = slugify(input)
def slugify(input: String): String = {
import java.text.Normalizer
Normalizer.normalize(input, Normalizer.Form.NFD)
.replaceAll("[^\\w\\s-]", "") // Remove all non-word, non-space or non-dash characters
.replace('-', ' ') // Replace dashes with spaces
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
kapkaev / The Technical Interview Cheat
Created September 8, 2016 04:32 — forked from tsiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
kapkaev / 0: jvm-options-java8.conf
Created June 16, 2016 23:00 — forked from elifarley/0: jvm-options-java8.conf
JVM options to maximize performance
# See
# See
# See
# See
# See
# -XX:+LogCompilation
# -XX:+PrintInlining
kapkaev / System
Created April 18, 2016 06:12 — forked from vasanthk/System
System Design Cheatsheet

#System Design Interview Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
kapkaev /
Last active March 22, 2016 19:48 — forked from wdullaer/
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r) apt-transport-https ca-certificates
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
kapkaev / countries.sql
Created February 9, 2016 22:43 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
kapkaev / dma_codes.rb
Last active January 27, 2016 21:52 — forked from sillypog/
Major US Cities with Latitude/Longitude and DMA Codes
[{:city=>"Ada", :region=>"OK", :dma_code=>657},
{:city=>"Akron", :region=>"OH", :dma_code=>510},
{:city=>"Albany", :region=>"GA", :dma_code=>525},
{:city=>"Alexandria", :region=>"LA", :dma_code=>644},
{:city=>"Alpena", :region=>"MI", :dma_code=>583},
{:city=>"Altoona", :region=>"PA", :dma_code=>574},
{:city=>"Amarillo", :region=>"TX", :dma_code=>634},
{:city=>"Ames", :region=>"IA", :dma_code=>679},
{:city=>"Anchorage", :region=>"AK", :dma_code=>743},
{:city=>"Anderson", :region=>"SC", :dma_code=>567},