Skip to content

Instantly share code, notes, and snippets.

View jevy's full-sized avatar

Jevin Maltais jevy

View GitHub Profile
@jevy
jevy / gist:1477961
Created December 14, 2011 19:00
Sample API for a Postcard Design
{ design:
product: 5, # The ID of the postcard product
pages: [
images: [
main_image # ID of the image uploaded elsewhere
]
,
text_fields: [
sender_name,
sender_street,
@jevy
jevy / gist:2995738
Created June 26, 2012 13:17
Device Identifier Integration Spec
require 'spec_helper'
# Type of discount: Free product (postcard)
# Conditions: Start/Stop (Aug X, Aug Y)
# Minimum number of specified products purchased: 1 Postcard
# Maximum # of total uses: 20
# Used by anyone (any device as he might pass it to his friends)
describe 'Unique device promo code', :focus do
@jevy
jevy / waterlevel.R
Created August 15, 2012 12:51
R code to generate graph of Water Levels in Ottawa
## changeing the working directory.
diegoDir='/Users/jevin/Code/personal/r/waterLevel'
setwd(diegoDir)
require(XML)
## getting the data from the web
x = readLines("http://www.ottawariver.ca/arnprior.htm")
tableNodes = getNodeSet(htmlParse(paste('</br>', x)), "//table")
@jevy
jevy / gist:3623438
Created September 4, 2012 16:57
Sample multiple product creation (v4)
{
"order":
{
"language_pref": "en",
"source_id":"iPhone v3.3",
"products_attributes": [
{
"type": "Postcard",
"message_text": "Check out this awesome picture!",
"image_external_id": "1111-1111-1111-1111",
@jevy
jevy / gist:7ece92c1a0d4d6d57294
Created January 3, 2015 02:43
Have Hazel sort images by exif date
# In Hazel select "run shell script". Shell is /bin/bash
/usr/local/bin/exiftool -d %Y-%m "-directory<AllDates" $1
@jevy
jevy / missing_files.py
Created July 13, 2017 15:07
Simple script to compare MD5s between two dirs and all subdirs to be there all the same files exists (ignores filenames and dir structure)
import argparse
import os
import hashlib
# Origin_dir_files = Build an MD5 hash of files with filenames in original dir (with subdirs)
# Destination_dir_files = Do the same for all in the destination dir
# Iterate over origin_dir_files to see each hash exists in Destination_dir_files. Print any that aren't
def get_all_filenames(root):
# to run: docker-compose run
#
# Create a .evn file in the same folder as this file and change the variables.
# MOUNT_POINT=/tmp/
# VPN_PROVIDER=changeme
# VPN_CONFIG=changeme
# VPN_USERNAME=changeme
# VPN_PASSWORD=changeme
#
#
14:31:18.139 DEBUG PushManager.initCrypt():70 - Encryption not enabled
14:31:18.144 DEBUG PushManager.init():41 - Getting user info...
14:31:18.701 DEBUG Is connected.websocketDidConnect():279 - PushManager
15:58:48.658 WARNING Is disconnected: Optional("The operation couldn’t be completed.websocketDidDisconnect():283 - PushManager
15:58:48.659 INFO PushManager.websocketDidDisconnect():286 - Reconnecting in 5 sec
15:58:53.703 WARNING PushManager.disconnect():52 - Trigged disconnect
15:58:53.936 DEBUG Is connected.websocketDidConnect():279 - PushManager
16:39:04.261 WARNING PushManager.disconnect():52 - Trigged disconnect
16:39:04.261 WARNING Is disconnected: nil.websocketDidDisconnect():283 - PushManager
16:39:04.262 INFO PushManager.websocketDidDisconnect():286 - Reconnecting in 5 sec
[nix-shell:~/code/personal/gnome-calendar-applet]$ poetry install
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
• Installing dbus-python (1.2.18): Failed
EnvCommandError
Command ['/home/jevin/.cache/pypoetry/virtualenvs/gnome-next-meeting-applet-AfKXBEeF-py3.9/bin/pip', 'install', '--no-deps', 'file:///home/jevin/.cache/pypoetry/artifacts/08/8e/4b/533a9277c305a960780320ddcac1c3ed323a213a78fcd0434298fabb72/dbus-python-1.2.18.tar.gz'] errored with the following return code 1, and output:
@jevy
jevy / default.nix
Last active February 15, 2022 00:09
Duplicity Backup
with import <nixpkgs> {};
let
duplicity_backupsh = fetchFromGitHub {
owner = "zertrin";
repo = "duplicity-backup.sh";
rev = "595aded06f96d91cbe44662712f6e5614ce89220";
sha256 = "1xzmz7fcr3vjcxhbjla3kvc49g3xgbs065pjd167jfqvgxj51m7l";
};