Skip to content

Instantly share code, notes, and snippets.

Mark Woodbridge mrw34

Block or report user

Report or block mrw34

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrw34
mrw34 / INSTALL.sh
Created Mar 17, 2018
Install "go read" on App Engine using Google Cloud Shell
View INSTALL.sh
# open https://console.cloud.google.com/home/dashboard?cloudshell=true
PROJECT_ID=go-read-123456
gcloud projects create $PROJECT_ID
gcloud app create --project=$PROJECT_ID
goapp get -d github.com/mjibson/goread
cd ~/gopath/src/github.com/mjibson/goread/app/
sed s/go-read/$PROJECT_ID/ app.sample.yaml >app.yaml
cp ../settings.go.dist ../settings.go
goapp deploy
@mrw34
mrw34 / postgres.sh
Last active Oct 15, 2019
Enabling SSL for PostgreSQL in Docker
View postgres.sh
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
chown 70 server.key
docker run -d --name postgres -v $PWD/server.crt:/var/lib/postgresql/server.crt:ro -v $PWD/server.key:/var/lib/postgresql/server.key:ro postgres:11-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@mrw34
mrw34 / package.json
Created Apr 6, 2016
Mixpanel export
View package.json
{
"dependencies": {
"moment": "^2.12.0",
"request": "^2.70.0",
"underscore": "^1.8.3"
}
}
@mrw34
mrw34 / mailx.sh
Last active Feb 29, 2016
A primitive mailx emulator using bash, curl and Mailgun
View mailx.sh
#!/bin/bash
set -eu -o pipefail
cmd="curl -s --user 'api:$MAILGUN_API_KEY' https://api.mailgun.net/v2/$MAILGUN_DOMAIN/messages"
while getopts "r:c:b:s:a:E" opt; do
case $opt in
r)
cmd+=" -F from='$OPTARG'"
;;
@mrw34
mrw34 / package.json
Created Dec 14, 2015
West London Xmas Hack Night
View package.json
{
"dependencies": {
"underscore": "^1.8.3",
"vorpal": "^1.4.0",
"ws": "^0.8.1"
}
}
@mrw34
mrw34 / gist:b12531d1a8df25f6c170
Last active Jul 29, 2019
Trello JSON to CSV conversion using jq
View gist:b12531d1a8df25f6c170
jq -r '["List", "Card"], ((reduce .lists[] as $list ({}; .[$list.id] = $list.name)) as $lists | .cards[] | select(.closed != true) | [$lists[.idList],.name]) | @csv' <nw3RUeLl.json
@mrw34
mrw34 / index.js
Last active Apr 11, 2016
Stable JavaScript Object hash function for Node.js
View index.js
function hash(object, algorithm, encoding) {
var h = require('crypto').createHash(algorithm || 'md5');
(function update(v, k) {
if (k !== undefined) {
h.update(JSON.stringify(k));
}
if (v && v.constructor === Array) {
v.forEach(function(value) {
update(h, value);
});
@mrw34
mrw34 / blog.xml
Created May 26, 2014
Minimal Jekyll Atom feed template
View blog.xml
---
---
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{site.title}}</title>
<id>http://{{site.domain}}/</id>
<updated>{{site.time | date_to_xmlschema}}</updated>
<link href="http://{{site.domain}}/blog.xml" rel="self"/>
{% for post in site.posts %}
View main.html
<body>
{{> hello}}
</body>
<template name="hello">
{{#with people}}
{{count}}
{{/with}}
</template>
You can’t perform that action at this time.