Skip to content

Instantly share code, notes, and snippets.

View vertexclique's full-sized avatar
🎛️
https://sptfy.com/QnOi

Theo M. Bulut vertexclique

🎛️
https://sptfy.com/QnOi
View GitHub Profile
@gavinheavyside
gavinheavyside / trivial_file_upload_service.rb
Created November 3, 2009 20:09
Trivial file upload service using Sinatra
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])
int gcd( int a, int b)
{
int temp;
while(b>0)
{
if(a>b)
{temp=a;
a=b;
b=temp;}
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@arosien
arosien / gist:1712108
Created January 31, 2012 18:41
scalaz operator cheat sheet
F[A] // A is a Functor
M[A] // A is a Monad
fa: F[A], a: A // variables used below
fa1 |+| fa2 // binary append (SemiGroup)
fa1 >| fa2 // map (Functor)
fa1 >>= fa2 // flatmap (Bind)
fa1 |>| fa2 // foreach (Each)
fa <**> fb { (a, b) => c } // apply, produces F[C]
@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
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
@kirelagin
kirelagin / Huffman.lhs
Created October 13, 2012 21:44
Very simple implementation of Huffman coding in Haskell
> module Huffman where
> import Control.Arrow
> import Data.List
> import qualified Data.Map as M
> import Data.Function
This typeclass is supposed to make life _a bit_ easier.
@mavam
mavam / bro-customization.md
Last active July 27, 2020 02:14
Bro script-level customization points.

General

# Process packets despite bad checksums.
redef ignore_checksums = T;

File Analysis

This will change significantly with Bro 2.2 when we have the file analysis

@saghul
saghul / app.py
Created July 9, 2013 22:28
WSGI + WebSocket + static files Twisted example
import os
from autobahn.resource import WebSocketResource, WSGIRootResource
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol
from flask import Flask, render_template
from twisted.application import internet, service
from twisted.internet import reactor
from twisted.python.threadpool import ThreadPool
from twisted.web.server import Site
@aras-p
aras-p / preprocessor_fun.h
Last active April 28, 2024 15:25
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@subzey
subzey / readme.md
Last active September 1, 2018 06:08
Games with unusual spacetime

Games with unusual spacetime

2 Dimensions

Desktop puzzle game. Level design resembles Escher's "impossible" drawings and passable path varies depending on where player is located and in which direction he moves.