Skip to content

Instantly share code, notes, and snippets.

View albenik's full-sized avatar

Veniamin Albaev albenik

  • Moscow, Russia
View GitHub Profile

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham [email protected]

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@sandfox
sandfox / README.md
Created September 15, 2012 23:01
Quick and dirty instructions for building nginx with rtmp support

#Compiling Nginx with RTMP module

  1. Install the following packages sudo apt-get install python-software-properties dpkg-dev git
  2. Add Nginx repo sudo add-apt-repository ppa:nginx/stable
  3. Update package list sudo apt-get update
  4. Get nginx source (put this in it's own dir like /build sudo apt-get source nginx-full
@marzocchi
marzocchi / controller.php
Created August 2, 2012 15:12
Change a Doctrine entity's table name at runtime
<?php
class FooController extends Controller {
function fooAction() {
$em = $this->getDoctrine()->getEntityManager();
$cm = $em->getClassMetadata('FooBundle:FooEntity');
$cm->setTableName('special_table_name');
@phoboslab
phoboslab / mousemove.py
Created June 26, 2012 19:44
Python script to move the mouse cursor in windows with constant speed
import sys
import time
import win32api
if (len(sys.argv) < 4):
print "Usage: python mousemove.py dx dy speed"
sys.exit()
current = win32api.GetCursorPos()
cx = sx = current[0]
@jboner
jboner / latency.txt
Last active April 29, 2025 15:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nicerobot
nicerobot / README.md
Last active February 19, 2025 02:01
Mac OS X uninstall script for packaged install of node.js from https://stackoverflow.com/a/9287292/23056

To run this, you can try:

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh
@peterjmit
peterjmit / indexing_columns_doctrine2.yml
Created February 16, 2012 16:00
Mapping Indexes with Yaml in Doctrine 2
# Example. A category entity with a url friendly 'slug'
# we want to index on this slug because we will be using it
# to query with.
Vendor\CategoryBundle\Entity\Category:
type: entity
table: category
indexes:
# the name of the index
category_slug_idx:
@josiahcarlson
josiahcarlson / async_http_client.py
Created December 25, 2011 23:24
Simple asyncore/asynchat derived http client
'''async_http_client.py
Originally written December 25, 2011 by Josiah Carlson
Released into the public domain.
This simple asynchat.async_chat subclass offers the ability to connect to http
servers to download files. The example download_file() function shows how to
use the class to download files from a remote webserver, automatically
handling redirects and errors.
@mattheath
mattheath / Apple Keyboard Autohotkey Script
Created March 24, 2011 12:37
A script for autohotkey to remap keys when using an Apple Keyboard with a Windows PC
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Matt Heath <[email protected]>
;
; Script Function:
; Remaps keys when using an Apple Keyboard with a Windows PC
;