Skip to content

Instantly share code, notes, and snippets.

require 'puppet/file_serving/metadata'
require 'puppet/type'
def generate
existing_files = Puppet::FileServing::Metadata.indirection.search(path, :recurse=>:true).each { |f|
full_path = ::File.join(base, relative_path)
}.to_set
# TODO: replace this code with something better. At least match start of line, please.
packaged_resources = `fgrep -h "#{dirname}/" /var/lib/dpkg/info/*.list`.split.to_set
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 1d0c3ad..156b420 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -807,14 +807,10 @@ int inet_shutdown(struct socket *sock, int how)
sk->sk_prot->shutdown(sk, how);
break;
- /* Remaining two branches are temporary solution for missing
+ /* Remaining branch is a temporary solution for missing
0. compile haproxy with patch: https://gist.github.com/hashbrowncipher/a0da32514f2f240cbbbf
1. start up new haproxy
2. haproxy becomes ready -> exits (after forking)
3. plug SYNs
4. send SIGUSR1 to old haproxy
5. flock(/var/run/synapse/haproxy_pids/PID.lock, LOCK_EX) -> blocks a bit
6. unplug SYNs
diff --git a/include/types/global.h b/include/types/global.h
index cb04074..90173ad 100644
--- a/include/types/global.h
+++ b/include/types/global.h
@@ -204,6 +204,7 @@ struct global {
int cache_size;
} _51degrees;
#endif
+ int socketlock;
};
#!/usr/bin/env python
"""
Copyright 2015 Josh Snyder
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
#!/usr/bin/env python
from __future__ import print_function
import argparse
import math
import sys
import time
def schedstat_loop(interval):
# scale time spent in the scheduler by this factor
scale = 1024
@hashbrowncipher
hashbrowncipher / aptly_purge.rb
Created August 23, 2015 07:03
Puppet aptly_purge type
require 'set'
Puppet::Type.newtype(:aptly_purge) do
@doc = <<-EOD
Interfaces the Puppet package type with apt-mark, generating Puppet resources
in response. Packages managed by Puppet are marked as manually installed,
those not managed by Puppet are marked as automatically installed.
The apt-get autoremover is then simulated, generating a list of packages to
be removed. This type takes the resulting list and generates Puppet package
#!/bin/bash
set -e
# Set up an IFB device
modprobe ifb
ip link set dev ifb0 up
# Yes, I am accepting inbound connections on my laptop's WiFi
INFACE=wlan0
#include <fcntl.h>
#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define BLOCK_SIZE 1024 * 1024
@hashbrowncipher
hashbrowncipher / success_wrapper
Created January 21, 2015 17:19
a wrapper for touch(1)ing a file when a job succeeds, developed at Yelp
#!/bin/bash
set -eu
name="$1"
shift
"$@"
touch "/var/lib/success_wrapper/${name}"