Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from time import sleep
import sys
from pyroute2 import TaskStats
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink.taskstats import tcmd
from pyroute2.netlink.taskstats import TASKSTATS_CMD_GET
ts = TaskStats()
ts.bind()
#!/bin/bash
# This script is designed to give an overview of which files are present
# in a directory which Puppet does not manage. It isn't perfect, but it
# works reasonably well.
# Specifically, it doesn't understand whether a directory contains
# subdirectories that shouldn't be purged, and it doesn't query the Puppet
# fileserver.
set -o errexit
set -o nounset
float Q_rsqrt(float number)
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
frontend test
bind :13335
default_backend test
backend test
mode tcp
server test 127.0.0.1:1025 ssl no-sslv3 send-proxy verify none
00000000 50 52 4f 58 59 20 54 43 50 34 20 31 32 37 2e 30 |PROXY TCP4 127.0|
00000010 2e 30 2e 31 20 31 32 37 2e 30 2e 30 2e 31 20 34 |.0.1 127.0.0.1 4|
jq 'reduce (.modules[].resources | to_entries) as $item ([]; . + $item) | map(select(.value.type == "aws_s3_bucket")) | from_entries' prodt/terraform.tfstate
from hacheck_utils import hadown
from hacheck_utils import haup
from sleeper import Sleeper
from socket import gethostname
def wrap_operation(name, inner_op, wait, post, lock_delay):
""" Uses a distributed semaphore to wrap an operation, where an operation
is an arbitrary function.
Args:
@hashbrowncipher
hashbrowncipher / hi-josh
Created December 10, 2015 08:05 — forked from tdooner/hi-josh
hi josh
#!/bin/bash
set -e
# Set up an ingress qdisc. This queuing discipline will have handle 'ffff',
# and will gate all packets coming in via INFACE.
tc qdisc add dev $INFACE ingress handle ffff:
# Set up a u32 target filter for TCP filtering. It will be associated with
# qdisc ffff. Its priority is 5. If someone comes along and adds a filter
# with lower priority, that filter will take precedence.
#!/bin/bash
set -e
set -o nounset
set -o pipefail
client=
server=
make_ssh_key() {