Skip to content

Instantly share code, notes, and snippets.

@BretFisher
BretFisher / docker-for-mac.md
Last active May 6, 2024 07:28
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
@codingtony
codingtony / buildHAProxy.sh
Last active March 8, 2019 10:48
Recipe to build HAProxy 1.7 using LibreSSL. Builds an almost static binary. See https://github.com/codingtony/docker-build-haproxy for how to use with a Docker Image
#!/bin/bash -e
DIR=$PWD/work
mkdir -p ${DIR}
rm -f ${DIR}/*.tar.gz
LIBRESSL=libressl-2.4.5
HAPROXY=haproxy-1.7.5
PCRE=pcre-8.39
@mnadel
mnadel / DatabaseCallable.java
Last active May 18, 2018 13:43
Dropwizard + Hystrix + Hibernate
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Callable;
/**
* A database session and transaction-aware Callable
*/
class DatabaseCallable<T> implements Callable<T>
@sh1n0b1
sh1n0b1 / ssltest.py
Created April 8, 2014 07:53
Python Heartbleed (CVE-2014-0160) Proof of Concept
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@laher
laher / loadchain.go
Last active September 25, 2022 04:16
how to load a certificate chain in Go. See how https://github.com succeeds and https://facebook.com fails.
package main
import (
"fmt"
"net/http"
"crypto/tls"
"crypto/x509"
"encoding/pem"
)
var chain=`-----BEGIN CERTIFICATE-----
MIIG5jCCBc6gAwIBAgIQAze5KDR8YKauxa2xIX84YDANBgkqhkiG9w0BAQUFADBs
@randomecho
randomecho / australian-postcodes.sql
Last active April 11, 2024 12:08
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@mindsocket
mindsocket / ingdirect.py
Created June 29, 2012 04:51
Munin plugin to log in to ING Direct (Australia) account and extract account balances
#!/usr/bin/env python
# -*- python -*-
#
# Plugin to track account balances on ingdirect.com.au, using selenium gymnastics to log in
#
# E.g.
# ln -s /usr/share/munin/plugins/ingdirect.py /etc/munin/plugins/ingdirect
#
# Needs (hint: pip install):
# selenium
@alisterscott
alisterscott / watir-webdriver-downloads.rb
Created June 15, 2012 11:46
How to check for downloads to complete and get the file name
require 'watir-webdriver'
file_name = nil
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
downloads_before = Dir.entries download_directory
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList'] = 2 # custom location
profile['browser.download.dir'] = download_directory
@mdeous
mdeous / repermute.py
Created February 13, 2012 16:04
generate all possible permutations of a regex
# -*- coding: utf-8 -*-
#
# Used like this:
#
# from repermute import ipermute
#
# for s in ipermute('[A-Z]\d'):
# print s
#
# Almost all regular expression constructs are supported except for '*'