Skip to content

Instantly share code, notes, and snippets.

@kapkaev
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
// http://www.mozilla.org/MPL/
//
// 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
kapkaev / The Technical Interview Cheat Sheet.md
Created September 8, 2016 04:32 — forked from tsiege/The Technical Interview Cheat Sheet.md
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
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 https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html
# See https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html
# See https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm
# See http://normanmaurer.me/blog_in_progress/2013/11/07/Inline-all-the-Things/
# See http://stas-blogspot.blogspot.com.br/2011/07/most-complete-list-of-xx-options-for.html
# -XX:+LogCompilation
# -XX:+PrintInlining
-Dfile.encoding=UTF-8
@kapkaev
kapkaev / System Design.md
Created April 18, 2016 06:12 — forked from vasanthk/System Design.md
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
kapkaev / install.sh
Last active March 22, 2016 19:48 — forked from wdullaer/install.sh
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://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@kapkaev
kapkaev / countries.sql
Created February 9, 2016 22:43 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`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,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@kapkaev
kapkaev / dma_codes.rb
Last active January 27, 2016 21:52 — forked from sillypog/major_us_city_dma_codes.py
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},
@kapkaev
kapkaev / kafka.md
Created December 7, 2015 19:22 — forked from ashrithr/kafka.md
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic