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

@pagles
pagles / keybase.md
Created August 5, 2016 14:47
Keybase proof

Keybase proof

I hereby claim:

  • I am pagles on github.
  • I am pagles (https://keybase.io/pagles) on keybase.
  • I have a public key ASBeMlfFFK-9I8P1fHHM-eU3iaPOHjbkgep0BS__fXHaTAo

To claim this, I am signing this object:

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 / gist:4131184
Last active October 13, 2015 03:18
Fresh install of postgres 9.2 with hstore and postgis 2.0.1
brew install postgres
brew install postgis (might need a pip install numpy - make sure you're not in a venv)
initdb /usr/local/var/postgres -E utf8
createdb template_postgis
psql -f /usr/local/share/postgis/postgis.sql template_postgis
psql -f /usr/local/share/postgis/spatial_ref_sys.sql template_postgis
createuser -sP [new user]
createdb -T template_postgis -O [new user] [new database]
psql [new database] [new user]
create extension hstore;