Skip to content

Instantly share code, notes, and snippets.

@darktable
darktable / app.yaml
Created March 16, 2011 19:10
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@cjyar
cjyar / memoize.go
Created December 1, 2013 01:29
Generic memoizer in Go.
package memoize
import (
"fmt"
"reflect"
)
// fptr is a pointer to a function variable which will receive a
// memoized wrapper around function impl. Impl must have 1 or more
// arguments, all of which must be usable as map keys; and it must
@egonelbre
egonelbre / table.go
Last active August 29, 2015 14:14
Hash Table implementation
package main
import (
"crypto/rand"
"fmt"
"time"
)
const (
keysize = 35 // bytes
@nerdalert
nerdalert / Netfilter-IPTables-Diagrams.md
Last active May 20, 2024 20:38
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@barosl
barosl / add.c
Created July 26, 2015 07:26
Function overloading in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addi(int a, int b) {
return a + b;
}
char *adds(char *a, char *b) {
char *res = malloc(strlen(a) + strlen(b) + 1);
@nerdalert
nerdalert / ipvlan_l3_mode_example.md
Last active July 30, 2019 10:54
IPVlan L3 Mode Two Host Example

Quick Paste Ipvlan L3 Instructions

  • Host #1
ip netns add ns1
ip link add link eth1 ipvl1 type ipvlan mode l3
ip link set dev ipvl1 netns ns1

ip netns exec ns1 bash

MacVlan Example

Macvlan can be attractive because it is bridgeless.

add two namespaces

ip netns add ns1
ip netns add ns2
@a-robinson
a-robinson / disconnect-dc.sh
Last active November 20, 2022 06:33
Docker compose file for 3-datacenter cockroachdb cluster with 2 nodes in each datacenter
docker network disconnect "${PWD##*/}_shared" roach-4
docker network disconnect "${PWD##*/}_shared" roach-5
@javdl
javdl / crostini_developer_install.sh
Last active August 28, 2021 19:07
Crostini script for developer install - Google Chrome OS (untested)
#!/bin/bash
# Author : Joost van der Laan
#
sudo apt update
sudo apt install wget unzip
sudo apt install curl
sudo apt install htop