Skip to content

Instantly share code, notes, and snippets.

View plindberg's full-sized avatar

Peter Lindberg plindberg

View GitHub Profile
@plindberg
plindberg / README.md
Created August 5, 2017 16:46
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.

README

Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.

Rich Hickey on becoming a better developer

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

  • Knowledge
  • Focus
@plindberg
plindberg / jaikuslurp.md
Created January 4, 2012 21:03
Archive your Jaiku on jaikuarchive.com!

As you may have heard, Jaiku is going away on January 15th. Perhaps you want to save your posts on Jaiku Archive. Here’s an easy way to do it, if you have a Mac or Unix machine.

Note that currently, you need Xcode on your Mac to be able to run this. Sorry for not realizing this up front. While it is free from the App Store, it would take you a while to download and install. However, I can’t guarantee that I’ll be able to rewrite the script to not require Xcode anytime soon.

If you have a Mac, hop into Terminal and enter the following, substituting “plindberg” for your Jaiku username.

If you’re on a Unix machine, you probably know what to do. But you’ll need Ruby 1.8.7 or later, and RubyGems.

bash < <(curl -s fleecelabs.se/jaikuslurp/) -s plindberg
@plindberg
plindberg / README.md
Last active July 4, 2018 07:39
Dump PostgreSQL table with JSONB column, qualifying by some JSON value, formatting for presentation using Heroku Dataclips

A while back, I wrote [a script to do daily dumps of a PostgreSQL table with a JSONB column][old one]. This was something an intern did daily for a client.

However, as summer came, we needed to automate this. The simplest and quickest solution turned out to do this using Heroku Dataclips.

I wasn’t aware of the [JSON functions and operators][json ops] of PostgreSQL, allowing you to both SELECT stuff from inside the JSON, and use in WHERE predicates. (It appears that you can even set up indexes on JSON values.)

@plindberg
plindberg / README.md
Last active June 27, 2018 15:05
Dump PostgreSQL table with JSONB column as TSV file, pasteable into Google Sheets

This script is one I wrote to dump a PostgreSQL table with a JSONB column into TSV put on your pasteboard (on macOS) such that you can just paste it into a Google Sheet.

I needed this for a client and it was a bit of work, so I thought it might be useful to someone out there.

@plindberg
plindberg / git-foreach-remote-show-latest-commit.sh
Last active May 21, 2018 12:57
Show most recent commit of each Git remote
git remote | \
xargs -n1 -I{} \
git log --oneline -1 --pretty=format:"%C(red)%h%d%C(reset) %s /%an, %ar" {}/master
Verifying my Blockstack ID is secured with the address 1KV2ZFAsWsPWLx7NVadUNSwAPpQtw3jsxw https://explorer.blockstack.org/address/1KV2ZFAsWsPWLx7NVadUNSwAPpQtw3jsxw
Verifying that +plindberg is my blockchain ID. https://onename.com/plindberg
@plindberg
plindberg / watson-dialog-capture-test.xml
Created February 19, 2016 15:45
Minimal Watson Dialog template for testing capturing user input.
<?xml version="1.0" encoding="UTF-8" ?>
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<flow><folder label="Main">
<output id="start">
<prompt>
<item>Hi. Enter anything and I’ll capture it.</item>
</prompt>
@plindberg
plindberg / ibm-watson-dialog-with-inline-javascript-function.xml
Last active June 22, 2016 14:41
A minimal example of a Watson Dialog XML script with an inline Javascript function.
<?xml version="1.0" encoding="UTF-8" ?>
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<flow>
<folder label="Main">
<output id="start">
<prompt>
<item>Write stuff and I’ll SHOUT it back to you.</item>
</prompt>