Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / linux-setup.sh
Last active November 15, 2024 19:55
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@bmcbride
bmcbride / fulcrum_mysql_webhook.php
Last active August 4, 2018 12:24
Fulcrum Webhook script for syncing data shares to a MySQL database. Requires PHP with PDO & allow_url_fopen enabled.
<?php
/**
* Title: Fulcrum Webhook for syncing data shares to MySQL database
* Notes: Requires PHP with PDO & allow_url_fopen enabled
* Author: Bryan R. McBride
* Source: https://gist.github.com/bmcbride/44afdc10ee943b4e7b92
*/
# Fulcrum app information
$formID = 'your-fulcrum-form-id';
@bmcbride
bmcbride / fulcrum-report-rename.sh
Last active July 22, 2016 00:14
Fulcrum PDF reports are named with the record's unique fulcrum_id. This bash script loops through the parent CSV file and renames the PDF files based on the index of user-specified fields.
#!/bin/bash
INPUT=fire_hydrants.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read -a csv_line
do
mv ${csv_line[0]}.pdf ${csv_line[8]}-${csv_line[0]}.pdf
done < $INPUT
@tknerr
tknerr / README.md
Last active February 11, 2019 19:42
Trying to get a minimal Vagrant with a Windows guest example to work...

Environment

If you are trying to reproduce this exactly, I'm using the following environment:

Basebox

First challenge is to get a windows basebox from somewhere. I couldn't find a good one, so built one myself from the windows/boxcutter packer templates:

@Orangenhain
Orangenhain / import_minimizer.rb
Created November 28, 2013 12:45
Script that takes a ObjC .m file and tries to find unused (or duplicate) import statements by commenting out each #import line in turn and seeing if the project still compiles. You will have to change BUILD_DIR & BUILD_CMD.
#!/usr/bin/env ruby -w
class String
def starts_with?(prefix)
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix
end
end
HEADER_REGEX = /^#import\s+["<](.*)[">]/
@akkerman
akkerman / Install PostGIS and GeoServer on Ubuntu 13.04.md
Last active May 28, 2023 01:53
Install PostGIS and GeoServer on Ubuntu 13.04

Install PostGIS and GeoServer on Ubuntu 13.04

PostGIS installation

Postgresql

Install the server:

sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 pgadmin3

Execute the psql command under user postgres (sudo -u postgres)
and connect to database postgres (psql postgres):

@colemanm
colemanm / qgis_open_photo_action.md
Last active February 3, 2020 20:45
Custom action to link to photos within a GIS feature class.

QGIS Open Image Custom Action

Use this guide to link a path name to a feature's photo in the attribute table.

This assumes you have a column in your data containing the full path to the image you'd like to open (in this example, a field called photo_path).

Create Action

  1. Right click feature class → Properties
  2. On Actions tab:
@zhm
zhm / mbtiles_delete_zoom_level.sql
Created October 3, 2012 23:09
Delete zoom levels from an MBTiles file (set max zoom)
-- change 18 to whatever the max zoom level you want in your MBTiles
DELETE FROM images WHERE
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 18) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 18);
DELETE FROM map WHERE zoom_level > 18;
UPDATE metadata SET value = '18' WHERE name = 'maxzoom';
def run_pg_fouine():
info = host_info[env.host_string]
db_name = info.tags.get('Name')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
time.sleep(30)
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt')
run('gzip -f /tmp/pgfouine.txt')