Skip to content

Instantly share code, notes, and snippets.

View katylava's full-sized avatar
🐢

katy lavallee katylava

🐢
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1NL1QgCqCFReoZGoE26UZwC2QJQJ3jJA4 https://explorer.blockstack.org/address/1NL1QgCqCFReoZGoE26UZwC2QJQJ3jJA4
@katylava
katylava / Array.reduce.js
Last active October 5, 2018 14:50
convert array of name/value objects to a single object with with matching name/value properties
// 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 August 24, 2017 18:36
go get private repo

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 March 27, 2023 18:09
docker-compose with Django and ipdb
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 August 7, 2023 14:37
Google Apps Script to import a CSV, stored securely on S3, to a Google Spreadsheet
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));
// 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,
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);
#!/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 October 3, 2014 15:56
Duck Duck Go's instant answer for "crontab cheat sheet"
# 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 August 22, 2014 22:03
ordered list
  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