Skip to content

Instantly share code, notes, and snippets.

@cotsog
cotsog / .travis.yml
Created July 31, 2015 16:09
.travis.yml for gcc-5 compiler support on Travis CI
sudo: required
script:
- sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
- gcc --version
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
#ifndef PRIORITY_QUEUE_H_
#define PRIORITY_QUEUE_H_
#include <iostream>
#include <vector>
#include <unordered_map>
#include <utility>
#include <functional>
@steve-jansen
steve-jansen / README.md
Last active February 23, 2024 22:38
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@fmela
fmela / enumerate-combinations.hxx
Created February 18, 2014 00:04
Enumerate every length-K combination of { 1, 2, ..., N } in ascending lexicographic order.
#include <vector>
#include <cassert>
// Call |f| with every length-K combination of { 1, 2, ..., N }, in ascending
// lexicographic order.
template<typename F>
void enumerate_combinations(size_t N, size_t K, const F& f) {
assert(K <= N);
std::vector<size_t> position;
// Initialize with initial position.
@fmela
fmela / flipsign.c
Created February 17, 2014 23:57
Branch-free conditional sign flip in C
int f(int x, int negate) {
return (x ^ -negate) + negate;
}
@fmela
fmela / GNUmakefile
Last active July 8, 2017 18:54
C++ program makefile boilerplate
SOURCES = $(wildcard *.cxx)
HEADERS = $(wildcard *.hxx)
OBJECTS = $(SOURCES:%.cxx=%.o)
PROGRAM = $(shell basename `pwd`)
CC := $(shell which clang || which gcc)
CFLAGS = -Wall -W -O -fno-exceptions -fno-rtti
LIBS = stdc++ m
LDFLAGS = $(LIBS:%=-l%)
@fmela
fmela / GNUmakefile
Created February 17, 2014 23:04
C program makefile boilerplate
SOURCES = $(wildcard *.c)
HEADERS = $(wildcard *.h)
OBJECTS = $(SOURCES:%.c=%.o)
PROGRAM = $(shell basename `pwd`)
CC := $(shell which clang || which gcc)
CFLAGS = -Wall -W -O
LIBS =
LDFLAGS = $(LIBS:%=-l%)
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
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