Skip to content

Instantly share code, notes, and snippets.

@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@taddev
taddev / gist:6212449
Last active September 8, 2023 00:41
Nginx Reverse Proxy with custom error if upstream proxy is not working.
server {
listen 80;
listen [::]:80 default server ipv6only=on;
location / {
proxy_intercept_errors on;
proxy_pass http://localhost:9000;
}
error_page 500 502 503 504 /50x.html;
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@bjaglin
bjaglin / remove-orphan-images.sh
Last active March 31, 2024 22:54
Remove orphan layers left by the "file" storage backend of the docker registry, heavily inspired by https://gist.github.com/shepmaster/53939af82a51e3aa0cd6
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/lib/docker/registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/usr/bin/jq
readonly repository_dir=$base_dir/repositories
@pwalsh
pwalsh / appengine-service-accounts-on-devserver.md
Last active May 17, 2022 18:07
Google App Engine Service Accounts that work in local development: A guide for the lost and weary

It is easy to get service accounts working with App Engine's app_devserver.py - once you know how.

On the way there, you might have pulled out all your hair following one documentation dead end after another, trying to piece together the right information.

Here are the steps you need to take, in exact order, to get this working. Once you follow these steps, you'll be able to use service accounts in local development, so that you can interact with Google APIs (e.g.: Spreadsheet, Calendar) in a way that is consistent with the deployment environment on App Engine.

In order to follow the instructions, you'll be better off using the latest UI for Google Cloud projects. Older interfaces (such as the dedicated App Engine dashboard) have things in different places, under different names, etc. It is a world of pain there.

Also note that I've tested this on several 1.9.x releases of App Engine; I can't confirm the behaviour of earlier releases.

@olov
olov / gist:eb60ab878eb73a7c5e22
Created October 15, 2014 08:55
listenandservetls_nossl30.go
// You don't want to serve HTTPS supporting for SSL3.0 any longer, see:
// http://googleonlinesecurity.blogspot.de/2014/10/this-poodle-bites-exploiting-ssl-30.html
import (
"crypto/tls"
"net/http"
)
// This code supports SSL3.0, TLS1.0, TLS1.1 and TLS1.2
// Chances are you currently do this but want to stop due to the POODLE
err := http.ListenAndServeTLS(addr, "crtfile", "keyfile", handler)
@jasonbrooks
jasonbrooks / kubernetes-ansible-atomic.md
Last active May 26, 2016 21:03
Install kubernetes on a centos or fedora atomic host using vagrant and ansible. I got this working and blogged about it: http://www.projectatomic.io/blog/2015/09/clustering-atomic-hosts-with-kubernetes-ansible-and-vagrant/. I'm keeping some notes about upstreaming my changes here.

The kubernetes ansible/vagrant install method can be used with the libvirt, virtualbox or openstack providers. The Vagrantfile requires that vagrant-openstack-provider be installed whether you're using it or not, so install it:

$ vagrant plugin install vagrant-openstack-provider

Alternatively, you can skip the second step above, but you'll need to comment out the require 'vagrant-openstack-provider' line in the Vagrantfile.

$ git clone https://github.com/jasonbrooks/contrib.git
@shamasis
shamasis / describe-it.js
Last active September 5, 2023 07:12
mocha/jasmine compatible test framework for postman test scripts (in less than 1KB minified)
/**
* @module describe-it
*
* This module defines global variables to provide unit test case runner functions compatible with mocha and jasmine.
* The codebase is written for brevity and facilitate being as lightweight as possible.
*
* The code is intended to be included in Postman Test Sandbox.
*/
/**
@warmfusion
warmfusion / README.md
Created October 5, 2015 14:17
failshell.io/sensu/2013/05/08/high-availability-sensu

High availability monitoring with Sensu

sensu | May 8, 2013

Redundancy. Availability. Scalability. Should sound familiar to you if you work in the web. Every system I build has to fit those 3 main criterias. I would also throw in manageability. If I can’t use Chef with it, I’m probably trying to use the wrong tool for the job.

There’s always been one exception though: my monitoring tool. Nagios. Zabbix. Zenoss. Shinken. Used them all. Each of them have shortcomings when it comes to the four criterias listed above. Different ones for each.

So, that said, a few months back, I was searching for something fresh. Something I could easily manage with Chef. Because I tend to forget things, and I wanted to automate as much as possible our monitoring solution. Don’t get me wrong, there’s nothing as good as developers to monitor your stuff, but I tend to like to know there’s something wrong before they show up at my desk. Even if it’s only 1-2 minutes ;)

@turtlemonvh
turtlemonvh / Caddyfile
Last active June 12, 2023 17:51
Multi-host wildcard caddy example
a.myhost.com {
tls off
root /var/www/
proxy / localhost:8091
log log/access.a.log
}
b.myhost.com {
tls off
root /var/www/