Skip to content

Instantly share code, notes, and snippets.

@dhutchison
dhutchison / CalibreAutoUpdate.sh
Last active January 6, 2018 15:52
Quick script to autoupdate calibre (http://calibre-ebook.com/) on OS X.
#!/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.
#################################
### 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 January 21, 2014 20:51
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…
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 March 16, 2014 21:38
Example of using property name interpolation in 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 20:39
Script for downloading a file at a URL and uploading the file to Dropbox. For use with Pythonista.
# 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 August 29, 2015 14:01
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
# Script to sync Pythonista files to Dropbox
# Author: David Hutchison
# www: http://www.devwithimagination.com/
# Now in the repository
# https://github.com/dhutchison/PythonistaScripts
@dhutchison
dhutchison / motion-illuminance.yaml
Created February 27, 2022 23:01 — forked from Danielbook/motion-illuminance.yaml
Motion and Illuminance level
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