Skip to content

Instantly share code, notes, and snippets.

Avatar
😷
wear a mask

katy lavallee katylava

😷
wear a mask
View GitHub Profile
View blockstack.txt
Verifying my Blockstack ID is secured with the address 1NL1QgCqCFReoZGoE26UZwC2QJQJ3jJA4 https://explorer.blockstack.org/address/1NL1QgCqCFReoZGoE26UZwC2QJQJ3jJA4
@katylava
katylava / Array.reduce.js
Last active Oct 5, 2018
convert array of name/value objects to a single object with with matching name/value properties
View Array.reduce.js
// we have an array of objects,
var myArray = [ { name: 'a', value: 1 }, { name: 'b', value: 2 }, { name: 'c', value: 3 } ];
// we want an object like { a: 1, b: 2, c: 3 }
// accumulator is an object, we'll set it to an empty object
// initially, when we call the reducer
// currentValue is the value of the current array element.
@katylava
katylava / README.md
Last active Aug 24, 2017
go get private repo
View README.md

Problem

> go get github.com/myorg/private-repo

# cd .; git clone https://github.com/myorg/private-repo mygopath/src/github.com/myorg/private-repo
Cloning into 'mygopath/src/github.com/myorg/private-repo'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/myorg/private-repo: exit status 128
@katylava
katylava / Dockerfile
Last active Jun 8, 2020
docker-compose with Django and ipdb
View Dockerfile
FROM python:3.5.1
MAINTAINER Katy Lavallee <katylava@gmail.com>
RUN mkdir -p /dockeripdb/
ENTRYPOINT ["/usr/local/bin/python"]
WORKDIR /dockeripdb/
ENV PYTHONPATH /dockeripdb/
ENV DJANGO_SETTINGS_MODULE dockeripdb.settings
@katylava
katylava / importS3Csv.gs
Last active Feb 26, 2020
Google Apps Script to import a CSV, stored securely on S3, to a Google Spreadsheet
View importS3Csv.gs
var AWS_KEY = '<your key>';
var AWS_SECRET = '<your secret>';
function generateS3Url(bucket, path) {
var expiresDt = Math.floor(Date.now() / 1000) + (60 * 60 * 24); // can be up to 7 days from now
var stringToSign = 'GET\n\n\n' + expiresDt + '\n/' + bucket + '/' + encodeURIComponent(path);
var hmac = Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_1, stringToSign, AWS_SECRET, Utilities.Charset.UTF_8);
var signed = encodeURIComponent(Utilities.base64Encode(hmac));
View exampleLabelary.js
// A Node.js example which uses the npm package "request" (https://www.npmjs.com/package/request)
// to send a POST request to convert a ZPL string to a PDF file.
var fs = require('fs');
var request = require('request');
var zpl = "^xa^cfa,50^fo100,100^fdHello World^fs^xz";
var options = {
encoding: null,
View testLabelary.js
var fs = require('fs');
var request = require('request');
request.post({ body: "^xa^cfa,50^fo100,100^fdHello World^fs^xz", encoding: null, url: 'http://api.labelary.com/v1/printers/8dpmm/labels/4x6.75/0/' }, function(err, resp, body) {
if (err) {
return console.log(err);
}
console.log('headers', resp.headers);
console.log('status', resp.statusCode);
View pending2ynab.py
#!/usr/bin/env python
"""
1. Copy pending transactions from chase.com
2. `pbpaste | path/to/pending2ynab.py > ~/Desktop/ynabimport.csv`
3. Import ~/Desktop/ynabimport.csv file into YNAB
"""
import re
import sys
@katylava
katylava / crontab
Created Oct 3, 2014
Duck Duck Go's instant answer for "crontab cheat sheet"
View crontab
# Commands are executed by cron when the minute, hour, and month of year
# fields match the current time, and at least one of the two day fields
# (day of month, or day of week) match the current time. A field may be
# an asterisk (*), which will always match.
#
# Fields in order:
# minute (0-59)
# hour (0-23)
# day of month (1-31)
# month (1-12 or first three letters)
@katylava
katylava / ol.md
Created Aug 22, 2014
ordered list
View ol.md
  1. stuff
  2. things
  3. more stuff
  4. more things
  5. number five
  6. dogs
  7. cats
  8. people
  9. monkeys
  10. i don't know what i'm talking about
You can’t perform that action at this time.