Skip to content

Instantly share code, notes, and snippets.


David Adam Coffey dacoffey

View GitHub Profile
deviantony /
Last active Sep 7, 2021
Portainer HTTP API by example


This gist is now deprecated in favor of our official documentation: which contains up to date examples!


Please refer to the link above to get access to our updated API documentation and examples.

actuino /
Last active Sep 29, 2021
Setting up a Bluetooth Speaker from the command line on a raspberry Pi Zero W

The setup of a bluetooth speaker on a Pi Zero W is pretty touchy.

Please get in touch via Twitter @actuino or if you've got comments or improvements to this quick draft.

First checks

  • Use a solid power source
  • check the speaker works on another hardware (android phone f.i.)
  • make sure you've updated your Raspbian, install and run rpi-update just in case.
hawkins / screen.js
Created Jan 16, 2017
Node.js blessed screen - keep your output separate from your input!
View screen.js
* I've used blessed to create a textbox at the bottom line in the screen.
* The rest of the screen is the 'body' where your code output will be added.
* This way, when you type input, your program won't muddle it with output.
* To try this code:
* - $ npm install blessed --save
* - $ node screen.js
* Key points here are:

Aligning images

left alignment

This is the code you need to align images to the left:

<img align="left" width="100" height="100" src="">
gbaman /
Last active Oct 22, 2021
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details -

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

balloob /
Last active Sep 15, 2020
Example platforms and automation component for Home Assistant
Copy this file to <config_dir>/example/
Add to your configuration.yaml:
platform: example
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
gbaman /
Last active Oct 23, 2021
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

jacobblock /
Last active Sep 16, 2021
Ultimate FreeNAS Setup


I started using FreeNAS in August 2013. It is fantastic piece of software and I have been really impressed by the upgrades just in the few months I've been using it. It looks like they recently went to a plugin system as of version 9 to make installing software easier for end users. I've ran into several issues related to plugins and user + group permissions so I decided to just use the available FreeBSD port system. After fiddling for a few days (now turned into months) I believe I have created something helpful for the community and anyone interested in picking up the port system. The sandbox nature of FreeNAS's jail system is especially helpful for playing around without having any consequence on your core system.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.


benstr /
Created Jan 31, 2014
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


anonymous / imgur_random.html
Created Dec 29, 2013
Quick-and-Dirty Image Randomizer using JavaScript and Imgur's RESTful API
View imgur_random.html
<!DOCTYPE html>
// I've omitted my Imgur client ID. You'll need to create and account and register your app which will give access to the API.