Skip to content

Instantly share code, notes, and snippets.

View pagles's full-sized avatar

Yorgos Pagles pagles

View GitHub Profile

The Best Medium-Hard Data Analyst SQL Interview Questions

By Zachary Thomas (zthomas.nc@gmail.com, Twitter, LinkedIn)

**Tip: **See the Table of Contents (document outline) by hovering over the vertical line on the right side of the page

Background & Motivation

The first 70% of SQL is pretty straightforward but the remaining 30% can be pretty tricky.

@pagles
pagles / nginx-to-ssh-tunnel.md
Last active January 31, 2019 14:53 — forked from gdamjan/README.md
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all.The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@pagles
pagles / infra-secret-management-overview.md
Created June 22, 2017 14:05 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@pagles
pagles / latency.markdown
Created October 11, 2016 14:53 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Requirements

  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).

Usage

The git.io URL (http://git.io/vsk46) is a shortened form of the raw url of the plist.

#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@pagles
pagles / pg_stat_statements
Created January 11, 2013 14:18 — forked from troyk/pg_stat_statements
Postgres stats
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020
2) add to postgresql.conf:
shared_preload_libraries = 'pg_stat_statements' # (change requires restart)
136 pg_stat_statements.max = 1000
137 pg_stat_statements.track = all
3) restart postgres
4) check it out in psql
@pagles
pagles / es.sh
Created February 29, 2012 18:23 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get install unzip
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.0.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
@pagles
pagles / gist:1097127
Created July 21, 2011 12:56 — forked from shun115/gist:789529
Python : pythonbrew + virtualenv 環境の構築
$ curl -kLO https://github.com/utahta/pythonbrew/raw/master/pythonbrew-install
$ chmod +x pythonbrew-install
$ ./pythonbrew-install
$ echo "source ~/.pythonbrew/etc/bashrc" >> .bashrc
$ source .bashrc
$ pythonbrew install -f 2.6.6 # なぜかtest_ioctlでこけたためforce
$ pythonbrew install -f 3.1.3 # 同上
$ pythonbrew switch 2.6.6