View pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all all md5
View deploy.hs
{-# LANGUAGE OverloadedStrings #-}
import Shelly
main = shelly $ do
run "echo" ["hello", "world"]
run "git" ["stash", "save"]
run "git" ["checkout", "develop"]
run "stack" ["clean"]
run "stack" ["build"]
View README.md

This python script is intended to automate the extraction of embedded certificates and keys from OpenVPN config files.

Unfortunately the GNOME Network-Manager is not able to automatically import OpenVPN config files with embedded certificates and keys. A workaround is to manually extract these and store them in separate files (e.g. see https://naveensnayak.wordpress.com/2013/03/04/ubuntu-openvpn-with-ovpn-file/).

Instructions:

  • Make shure all the required packages are installed. For example on Ubuntu and Debian run:

    $ sudo apt-get install python3 network-manager-openvpn-gnome

View export_pdf_layers_as_png.py
#!/usr/bin/env python
#
# Author: helour
# Copyright: 2013-2015 helour
# Based on the cr33dog's script Export Layers as PNG (http://registry.gimp.org/node/18440)
# License: GPL v3+
#
# Version: 0.7
#
# GIMP plugin to export layers as a multiple pages PDF file
View pQuery.js
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
View fold-long-lines.c
// This was my attempt at K&R 1-22
// Though, this implementation has a bug wherein the last word of a short line is always printed on its own line. This is because
// there's currently no way for the program to know when the "split" word would fit on the current line.
// This solution is nice because it will work with arbitrarily long lines.
// The lines are read-in (80 chars or less at a time), the last space is sniffed out, then the last word is split,
// a newline is printed, and the "split" word is printed. On the next loop, the get_line function ends N chars from
// the line break, in order to acommodate the "split" word which has already been printed on the current line.
#include <stdio.h>
View copy_s3_objects_from_one_bucket_to_another.rb
# inspired by: https://gist.github.com/dje/763977
def copy(source_bucket:, destination_bucket:, files:, connection:)
files.each_with_index { |file, index|
puts "copy #{file['Key']} to #{destination_bucket}" if index % 20 == 0
connection.copy_object source_bucket,
file['Key'],
destination_bucket,
file['Key']
}
View fizzbuzz.c
#include <stdio.h>
int main(void) {
int i;
for (i = 1; i <= 100; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
printf("fizzbuzz\n");
} else if (i % 3 == 0) {
printf("fizz\n");
} else if (i % 5 == 0) {
View gist:abdd5f43da4c128612a0d99f93990b77
In which I attempt to answer the question, "How/why are generics useful?"
reverse :: [a] -> [a]
-- reverse can operate on _any_ list: Int, Float, Bool, MyCustomTypeClass.
-- The alternative would be writing a reverse variant for every type:
intListReverse :: [Int] -> [Int]
charListReverse :: [Char] -> [Char]
sort :: Ord => [a] -> [a]
-- sort can operate on _any_ list which is an instance of Ord: Int, Float, Bool, MyCustomTypeClass