Skip to content

Instantly share code, notes, and snippets.

@hashbrowncipher
hashbrowncipher / hi-josh
Created December 10, 2015 08:05 — forked from tdooner/hi-josh
hi josh
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:
jq 'reduce (.modules[].resources | to_entries) as $item ([]; . + $item) | map(select(.value.type == "aws_s3_bucket")) | from_entries' prodt/terraform.tfstate
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|
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?
#!/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
#!/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
chrt -p -i 0 $$
file="$1"
field="$2"
lines=$(awk -v field=$field '$field ~ /[0-9][0-9.]*/ { count++ } END { print count }' "$file")
sort -k$field -nr "$file" | awk -v lines=$lines '
cd /bin
echo f0VMRgEAAAAAAAAAAAABAAIAAwAgAAEAIAABAAQAAACNQByQQM2AADQAIAAB | base64 -d > pause
chmod +x pause