Skip to content

Instantly share code, notes, and snippets.

@dahu
dahu / gist:11338846
Created April 27, 2014 06:21
Fog of War without SearchParty. He cries for your absence ;-(
hi FOW ctermfg=black ctermbg=NONE guifg=black guibg=NONE
call matchadd('FOW', '\%(.*\n\)\{1,20\}\ze\%(.*\n\)\{3\}.*\%#')
call matchadd('FOW', '.*\%#.*\%(\n.*\)\{3\}\zs\%(.*\n\)\{1,20\}')
@hsribei
hsribei / can-nat-traversal-be-tor-s-killer-feature.md
Last active September 24, 2024 14:43
Can NAT traversal be Tor's killer feature?

Can NAT traversal be Tor's killer feature?

tl;dr: how about a virtual global flat LAN that maps static IPs to onion addresses?

[We all know the story][1]. Random feature gets unintentionally picked up as the main reason for buying/using a certain product, despite the creator's intention being different or more general. (PC: spreadsheets; Internet: porn; smartphones: messaging.)

@kachayev
kachayev / concurrency-in-go.md
Last active January 6, 2025 22:43
Channels Are Not Enough or Why Pipelining Is Not That Easy
@peterhellberg
peterhellberg / build.sh
Created November 3, 2014 22:52
Set build date using the Go linker
#!/bin/bash
go build -ldflags "-X main.buildDate `date -u +%Y-%m-%d.%H%M%S`"
@jpillora
jpillora / sshd.go
Last active March 28, 2025 03:25
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wolever
wolever / Conly.vim
Created February 3, 2015 20:50
:Conly Vim command to close all windows in the current column.
" :Co[nly] closes all other windows in the current column.
" For example, if the cursor is in the "cur" window, below, windows 1, 2, and
" 4 will be closed:
" +-------+ +-------+
" | win 1 | | |
" +-------+ | |
" | win 2 | | |
" +-------+ --> :Conly --> | cur |
" | cur | | |
" +-------+ | |
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@mmchugh
mmchugh / obj_loader.py
Last active August 29, 2015 14:26
loads a wavefront .obj file and returns vertices and indices (if indices requested)
def load_obj(filename, indexed=True):
vertices = []
textures = []
normals = []
out_vertices = []
out_indices = []
vertex_map = {}
with open(filename) as obj_file:
@wolever
wolever / test_tsquery_escape.py
Last active October 3, 2022 09:47
Parse and escape a query string so it's safe to use with Postgres' `to_tsquery(…)`
import re
from nose.tools import assert_equal
from nose_parameterized import parameterized
from tsquery_escape import tsquery_escape
@parameterized([
("1 OR 2", "1 | 2"),
("(1) 2", "( 1 ) & 2"),
("&", "'&':*"),