Skip to content

Instantly share code, notes, and snippets.

@chris
chris / action-postgis.yml
Created July 7, 2020 20:10
GitHub Actions Postgres PostGIS service
services:
postgres:
image: postgis/postgis:10-2.5
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_PASSWORD: password
POSTGRES_DB: your_test_db_name
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
@vhermecz
vhermecz / custom_keys_git_ssh
Created June 8, 2020 11:20
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7
@kipcole9
kipcole9 / function_clause.ex
Created October 23, 2019 11:04
Debug Elixir Function Clause errors
defmodule FunctionClause do
@moduledoc """
Format function clauses using Exception.blame/3
"""
@doc """
Given a `module`, `function`, and `args` see
if that function clause would match or not match.
This is useful for helping diagnose function
@epk
epk / pi-hole.sh
Last active September 26, 2018 20:33
#!/bin/bash
mkdir -p /home/pi/pi-hole/pihole &&
mkdir -p /home/pi/pi-hole/dnsmasq.d &&
cd /home/pi/pi-hole &&
docker run -d \
--name pihole \
--restart=always \
--dns=1.1.1.1 \
--dns=8.8.8.8 \
-p 53:53/tcp -p 53:53/udp -p 80:80 -p 443:443 \
@zeg-io
zeg-io / dk-clean.sh
Created May 18, 2017 01:03
Clean all Docker images older than 4 weeks
oldContainers="$(docker ps -f "status=exited" | grep -E 'Exited \(.*\) [5-9] h|Exited \(.*\) \d\d h' | awk '{ print $1 }')"
echo -e -n "\nRemoving containers older than 4 hours"
if [ "$oldContainers" != "" ]; then
echo ""
docker rm $oldContainers
else
echo "...none found."
fi
@bruce
bruce / query.graphql
Created March 27, 2017 21:37
Adding a count to an absinthe_relay Connection
{
items(first: 5) {
count
edges {
node {
name
}
}
}
}

Powell's 6-Step Plan to NPM Happiness

When things go wrong:

  1. Do what the error says.
  2. rm -rf node_modules && npm install (if in Ember.js - rm -rf bower_components && bower install)
  3. rm -rf node_modules && rm -rf ~/.npm && npm install
  4. Reinstall node and npm.
  5. Format your harddrive.
  6. Buy a new computer.
@ymyzk
ymyzk / download.py
Created April 27, 2015 05:12
Download custom emojis from Slack
from __future__ import unicode_literals
import os
import sys
import requests
def get_emojis(token):
response = requests.get("https://slack.com/api/emoji.list",
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@qubyte
qubyte / writeHooksAsync.js
Last active December 31, 2015 13:59
A script to install git hooks. Run these as the `postinstall` script in package.json. The example here writes a pre-commit hook that runs `npm test`. By having this as a self-contained script and not as a Grunt or Gulp task, Gulp or Grunt can be strict devDependencies.
/* This script operates asynchronously. It can be written synchronously, but
* not a lot is saved once you try-catch everything. Uses the async module.
*
* MIT licence.
*/
var fs = require('fs');
var path = require('path');
var async = require('async');
// Write as many of these as you like.