Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chris Jamieson jamiesoncj

Block or report user

Report or block jamiesoncj

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
@jamiesoncj
jamiesoncj / add-printer.md
Last active Apr 29, 2019
Install Epson AL-M1200 printer on Ubuntu
View add-printer.md

Ubuntu seems to have trouble talking to the Epson AL-M1200 printer. These instructions will get it working. Based on a set of instructions found here.

  1. Download epsoneplijs-0.4.1.tgz -file from here
  2. cd Downloads (or whatever directory you downloaded the file to)
  3. tar zxvf epsoneplijs-0.4.1.tgz
  4. cd epsoneplijs-0.4.1
  5. ./configure --prefix=/usr
  6. sudo make install
  7. Download PPD file from here or here
  8. Connect your printer to your computer and turn it on. (You can do it in the beginning, but at least now you need it connected and powered on.)
@jamiesoncj
jamiesoncj / setup.md
Created Apr 19, 2016
Set up Franz for Ubuntu
View setup.md
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
@jamiesoncj
jamiesoncj / setup-instructions.md
Created Aug 24, 2016
Crib sheet: set up a static website on AWS S3
View setup-instructions.md

Crib sheet: set up a static website on AWS S3

A useful walkthrough is also available on docs.aws.amazon.com.

Set up S3 buckets and configure them for web hosting

  1. Open the AWS console and choose s3 link
  2. Create a new bucket, naming it exactly as your domain name e.g. mydomain.com
  3. Open the Permissions settings and click "Edit bucket policy", setting the value to a policy as follows (remember to swap in your bucket name):
@jamiesoncj
jamiesoncj / .gitignore
Created Jan 28, 2019
Basic gitignore starter
View .gitignore
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
@jamiesoncj
jamiesoncj / functional-spec.md
Created Mar 9, 2017
Writing functional specification guidelines
View functional-spec.md

Once you are ready to hire a developer, what should you do to mitigate execution / build risk?

  1. Writing a good functional specification is key to getting the build phase of this project right. It's not easy to do but it's mostly just about thinking hard and writing out all the boring details of your desired outcome. The best guide for this is Joel Spolsky (recently sold Trello for $425M). He wrote a 4 part series on this, starting here, and also has an example (real) spec on his website here (the PDF link is broken, this is the real one)

  2. Before you start on a spec, trim down your functionality to the absolute bare minimum - and be brutal with it! Imagine you had to complete it in one day, or imagine it was only a single feature... take away everything that isn't fundamental

@jamiesoncj
jamiesoncj / proxy_handler.php
Created Oct 18, 2015
Random proxy rotation
View proxy_handler.php
<?php
// suggest buying proxies from http://buyproxies.org/ - I found this to be an excellent service and well-priced too.
// function returns a keyed array of proxy info
// if you want you can pass a specific ID in (for instand if you want to use the same proxy for a sequence of calls
function custom_proxy_handler_get_proxy($proxy_id = 0)
{
$all_proxies = array(
@jamiesoncj
jamiesoncj / gc-webhook.js
Last active Feb 14, 2018
GoCardless Node / Express signature verification middleware
View gc-webhook.js
const crypto = require('crypto');
/**
* Express middleware to validate incoming webhook request from Gocardless
* @param {*} req Express request
* @param {*} res Express response
* @param {*} next Next middleware function if succeeds
*/
function verifyGocardlessWebhook(req, res, next) {
if (!req.headers['webhook-signature']) {
@jamiesoncj
jamiesoncj / snippet.js
Created Nov 26, 2017
Sequelize snippet for sorting (REST api)
View snippet.js
// snippet to help feed sort parameters into Sequelize query
// following Vinay Sahni's best practices (http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api)
// e.g. https://my-url.com/api/v1/sausages?sort=-createdAt,name
function list (req, res, next) {
const findOptions = {
order: [],
};
// handle sorting / ordering
if (req.query.sort) {
View keybase.md

Keybase proof

I hereby claim:

  • I am jamiesoncj on github.
  • I am jamiesoncj (https://keybase.io/jamiesoncj) on keybase.
  • I have a public key whose fingerprint is 1B2F 5829 5041 AD17 5949 C867 A499 CCD4 E147 3F2F

To claim this, I am signing this object:

@jamiesoncj
jamiesoncj / soap-watcher.js
Created Sep 26, 2017
node soap watcher snippet
View soap-watcher.js
// Node SOAP client event watcher for https://github.com/vpulim/node-soap
client.on('response', (responseBody, incomingMessage) => {
console.log('response! responseBody: ', responseBody);
});
You can’t perform that action at this time.