Skip to content

Instantly share code, notes, and snippets.

View rozgo's full-sized avatar

Alex Rozgo rozgo

View GitHub Profile
@rozgo
rozgo / node-on-ec2-port-80.txt
Created June 13, 2011 16:34 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80
THE PROBLEM:
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)
THE TEMPTINGLY EASY BUT TOTALLY WRONG SOLUTION:
Alter the port the script talks to from 8000 to 80:
}).listen(80);
@rozgo
rozgo / gist:1027953
Created June 15, 2011 19:58
Gestures
// alex@rozgo.com
using UnityEngine;
using System.Collections;
public class Gestures : MonoBehaviour {
float lastf0f1Dist;
void Update () {
@rozgo
rozgo / gist:1145591
Created August 15, 2011 01:54
view matrix reminders
for a modelview matrix is:
m0 m4 m8 m12
m1 m5 m9 m13
m2 m6 m10 m14
m3 m7 m11 m15
then:
(m0,m1,m2): X-Model in View coord.
@rozgo
rozgo / socket buffer
Created June 19, 2013 23:57
increase socket buffer
# increase TCP max buffer size settable using setsockopt()
net.core.rmem_max=16777216
net.core.wmem_max=16777216
# increase Linux autotuning TCP buffer limit
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
# increase the length of the processor input queue
net.core.netdev_max_backlog=30000
using UnityEngine;
using System.Collections;
using System.IO;
public class ExecuteCommand : MonoBehaviour
{
void Start ()
{
//string path = Directory.GetCurrentDirectory();
given this:
$ git status
# On branch muzzle_flash
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Assets/Ammo/CannonBall.prefab
#include <SDKDDKVer.h>
#include <Windows.h>
#pragma warning(disable:4819)
#pragma warning(disable:4996)
// for OpenCV2
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/gpu/gpu.hpp"
@rozgo
rozgo / broker
Created September 26, 2013 00:17
#include <websocketpp/config/asio.hpp>
#include <websocketpp/server.hpp>
#include <iostream>
#include <websocketpp/common/thread.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
typedef websocketpp::server<websocketpp::config::asio> server;
using websocketpp::connection_hdl;
module Bowel.Bow
module Player =
type UserId = UserId of string
type UserName = UserName of string
type Player =
{
UserId : UserId
// Creating new threads
open System
open System.Threading
//What will execute on each thread
let threadBody() =
for i in 1..5 do
//Wait 1/10 of a second
Thread.Sleep(100)
printfn "[Thread %d] %d ..."