Skip to content

Instantly share code, notes, and snippets.

View adamatan's full-sized avatar

Adam Matan adamatan

View GitHub Profile
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@porjo
porjo / timelapse.md
Last active May 25, 2023 16:14
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
@kracekumar
kracekumar / ws_app.py
Last active October 5, 2021 08:52
Simple websocket server with uvloop.
# -*- coding: utf-8 -*-
import asyncio
import uvloop
from aiohttp.web import Application, MsgType, WebSocketResponse
def add_socket(app, socket, user_id):
if user_id in app['connections']:
pass
@danihodovic
danihodovic / main.tf
Created January 8, 2017 20:48
Terraform - static site using S3, Cloudfront and Route53
variable "aws_region" {
default = "eu-west-1"
}
variable "domain" {
default = "my_domain"
}
provider "aws" {
region = "${var.aws_region}"
@ronreiter
ronreiter / longest.py
Created March 14, 2017 20:07
Longest word in Hebrew
a = open("/Users/Ron/words.txt").read().decode("utf8").split()
first_row = ["ק", "ר", "א", "ט", "ו", "ן", "ם", "פ"]
second_row = ["ש", "ד", "ג", "כ", "ע", "י", "ח", "ל", "ך", "ף"]
third_row = ["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"]
first_row = [x.decode("utf8") for x in first_row]
second_row = [x.decode("utf8") for x in second_row]
third_row = [x.decode("utf8") for x in third_row]
only_first = sorted([(len(x), x) for x in a if all(y in first_row for y in x)])
only_second = sorted([(len(x), x) for x in a if all(y in second_row for y in x)])
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@widdowquinn
widdowquinn / github_pages_jekyll_minimal_mistakes.md
Created December 19, 2017 17:56
Create a Jekyll blog on GitHub Pages, using the Minimal-Mistakes Theme

Creating a Jekyll blog on GitHub Pages with Minimal-Mistakes

Setup

First, create a new Jekyll site and corresponding GitHub Pages repository, then test it locally at http://localhost:4000:

$ gem install jekyll bundler
$ jekyll new <REPO>/
Running bundle install in /Users/<USER>/Development/GitHub/<REPO>...