Skip to content

Instantly share code, notes, and snippets.

@adnils
adnils / Makefile
Created May 15, 2017 12:07 — forked from sehe/Makefile
Boost shared memory lockfree circular buffer queue
all:consumer producer
CPPFLAGS+=-std=c++03 -Wall -pedantic
CPPFLAGS+=-g -O0
CPPFLAGS+=-isystem ~/custom/boost/
LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib
LDFLAGS+=-lboost_system -lrt -lpthread
%:%.cpp
@adnils
adnils / server.ex
Last active August 11, 2020 16:37
Elixir TCP echo server
defmodule Echo.Server do
def start(port) do
tcp_options = [:binary, {:packet, 0}, {:active, false}]
{:ok, socket} = :gen_tcp.listen(port, tcp_options)
listen(socket)
end
defp listen(socket) do
{:ok, conn} = :gen_tcp.accept(socket)
spawn(fn -> recv(conn) end)
" paper.vim - Vim color scheme for 16-color terminals
" --------------------------------------------------------------
" Author: Adrian Nilsson
" Version: 0.0.1
" --------------------------------------------------------------
set background=light
hi! clear
if exists("syntax_on")
/*
d3.phylogram.js
Wrapper around a d3-based phylogram (tree where branch lengths are scaled)
Also includes a radial dendrogram visualization (branch lengths not scaled)
along with some helper methods for building angled-branch trees.
Copyright (c) 2013, Ken-ichi Ueda
All rights reserved.
@adnils
adnils / whatsapp_phone_enumerator_floated_div.js
Created May 12, 2017 11:06
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses (floated div)
/*
PoC WhatsApp enumeration of phonenumbers, profile pics, about texts and online statuses
Floated div edition
01-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
This script creates a UI on top of the WhatsApp Web interface. It enumerates certain kinds
of information from a range of phonenumbers. It doesn't matter if these numbers are part
of your contact list. At the end a table is displayed containing phonenumbers, profile pics,
about texts and online statuses. The online statuses are being updated every
@adnils
adnils / pre-commit
Created October 26, 2016 10:54 — forked from AustinDizzy/pre-commit
A pre-commit git hook that prompts you to automatically `gofmt` Go files staged to commit.
#!/bin/sh
# Modified 2015, Austin Dizzy
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
@adnils
adnils / pre-commit
Created April 20, 2016 12:39 — forked from kuy/pre-commit
git: pre-commit hook script to prevent committing FIXME code
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1
@adnils
adnils / af-magic.zsh-theme
Created December 10, 2013 08:24
fix virtualenv
# af-magic.zsh-theme
#
# Author: Andy Fleming
# URL: http://andyfleming.com/
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
#
# Created on: June 19, 2012
# Last modified on: June 20, 2012
@adnils
adnils / nginxproxy.md
Created December 18, 2015 10:06 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@adnils
adnils / channel-example.swift
Created December 4, 2015 12:34 — forked from kainosnoema/channel-example.swift
Golang-like concurrency semantics in Swift
import Foundation
go(println("in a thread"))
// buffered channel
var c = Chan(buffer:20)
// sending routing
go {
while(true) {