Skip to content

Instantly share code, notes, and snippets.

@dhutchison
dhutchison / CalibreAutoUpdate.sh
Last active Jan 6, 2018
Quick script to autoupdate calibre (http://calibre-ebook.com/) on OS X.
View CalibreAutoUpdate.sh
#!/bin/bash
# Script to autoupdate Calibre (http://calibre-ebook.com/)
# Author: David Hutchison
# www: http://www.devwithimagination.com/
#################################
######### CONFIGURATION #########
# These default values should work for everyone. Only change if using a non-standard install location,
# or if the download URL changes in the future.
#################################
View New from Gist.py
### Based on: https://gist.github.com/b0644f5ed1d94bd32805
### This version strips unicode characters from the downloaded script
### to work around the currently limited unicode support of the editor
### module.
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
@dhutchison
dhutchison / 2014-01-16-single-post.md
Created Jan 21, 2014
Example of referring to authors using Jekyll's _data structures. You can reference the data in a collection in a variety of ways. Line 13 of post.html shows you can: 1. look up a value in the "author" collection relative to a variable defined in the YAML of a page using the layout 2. explicitly naming the data item in code 3. a combination of th…
View 2014-01-16-single-post.md
layout title date author
post
My New Post
2014-01-16 23:05
david

This is my great post with the correct poster.

@dhutchison
dhutchison / example.less
Created Mar 16, 2014
Example of using property name interpolation in Less.
View example.less
.mySelector {
.remSize(font-size, 1.2);
}
.remSize(@property; @sizeValue) {
@remValue: @sizeValue;
@pxValue: round((@sizeValue * unit(@fontSizeStandard)));
@{property}: ~"@{pxValue}px";
@{property}: ~"@{remValue}rem";
@dhutchison
dhutchison / FileDownloader.py
Created May 6, 2014
Script for downloading a file at a URL and uploading the file to Dropbox. For use with Pythonista.
View FileDownloader.py
# Script for downloading a URL to Dropbox
import sys
import urllib2
import urllib
import dropbox
import os
import console
# Configuration
DOWNLOAD_FOLDER = 'downloads'
@dhutchison
dhutchison / DropboxSync.py
Last active Aug 29, 2015
Python script for use with Pythonista which will sync all scripts to Dropbox. Requires a Dropbox API key. This script has moved to: https://github.com/dhutchison/PythonistaScripts
View DropboxSync.py
# Script to sync Pythonista files to Dropbox
# Author: David Hutchison
# www: http://www.devwithimagination.com/
# Now in the repository
# https://github.com/dhutchison/PythonistaScripts
View motion-illuminance.yaml
blueprint:
name: Motion-activated Light with illuminance
description: Turn on a light when motion is detected and illuminance is below a set Lux level.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor