This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eEu | |
set -o pipefail | |
# Use env var to hide corporate namespace. | |
GITHUB_BASE_URL="${GITHUB_BASE_URL:-https://ghe.example.com}" | |
echo 'Get ratelimit with REST API v3' | |
curl \ | |
-H 'Accept: application/vnd.github+json' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Script to open a sqlite3 database and dump all user tables to CSV files. | |
Tested in Unicode-rich environment. | |
Usage: | |
dumpsqlite3tocsv foo.db | |
""" | |
import sqlite3, csv, codecs, cStringIO, os, os.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eEu | |
set -o pipefail | |
do_something() { | |
some_date=$1 | |
echo "$some_date" | |
} | |
# https://stackoverflow.com/a/25701358 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.9 | |
# docker build --rm -t relay --build-arg proxy=<something> . | |
ARG proxy | |
RUN http_proxy=${proxy} https_proxy=${proxy} \ | |
apk --no-cache --available upgrade | |
RUN http_proxy=${proxy} https_proxy=${proxy} \ | |
apk --no-cache add exim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This list is used by git-shortlog to fix botched name translations in the git archive, | |
# making contributions from the same person appear not to be so. | |
# Reasons include: | |
# - the author's full name was messed up and/or | |
# - not always written the same way | |
# - the author has multiple email addresses | |
# | |
# Note: NEVER REMOVE A MAILMAP ENTRY. | |
# These maps tie a commit author to a real human for accountability. | |
# If you remove a mailmap, then we lose the tie between author and human. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Configure various overrides and exceptions in this file. | |
# See https://pre-commit.com/ for details. | |
fail_fast: false | |
repos: | |
- repo: local | |
hooks: | |
- id: check-mailmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.3 | |
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories | |
RUN apk add --no-cache exim | |
COPY . / | |
RUN /usr/sbin/harden.sh | |
# Volumes must be created AFTER we harden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copyright 2020 Paul Morgan | |
# License: GPLv2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | |
set -x | |
set -e | |
# | |
# Docker build calls this script to harden the image during build. | |
# | |
# NOTE: To build on CircleCI, you must take care to keep the `find` | |
# command out of the /proc filesystem to avoid errors like: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blah | |
def table | |
{ | |
:dword => :read_dword, | |
:string => :read_string, | |
} | |
end | |
def read_string(a_key) | |
puts 'string' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Demonstrate memory resource limits in docker | |
# See also http://stackoverflow.com/a/20111960 | |
function demo() { | |
mem=$1 | |
echo "Run a container and limit to $mem" | |
cid=$(docker run -d -m $mem busybox /bin/sh -c "tail -f /var/log/*") |
NewerOlder