Skip to content

Instantly share code, notes, and snippets.

View celeryclub's full-sized avatar
:octocat:

Steve Davis celeryclub

:octocat:
View GitHub Profile
@celeryclub
celeryclub / Raspberry Pi Hass.io setup guide.md
Last active May 22, 2019 14:20
Raspberry Pi Hass.io setup guide.md

First, set up Raspbian.

Install prereqs.

sudo apt-get install apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat software-properties-common

Install docker.

curl -sSL https://get.docker.com | sh

@celeryclub
celeryclub / Raspberry Pi VPN Server.md
Last active August 16, 2021 17:27
Raspberry Pi VPN Server
@celeryclub
celeryclub / Raspberry Pi Music Server.md
Last active November 22, 2020 08:30
Raspberry Pi Music Server

First, install Raspbian.

Configuring your sound card

This configuration works with HiFiBerry DACs and the Sabre ES9023 chip.

If you are using WiFi, turn off WiFi Power Management.

$ sudo iwconfig wlan0 power off
sentence = 'Sometimes (when I nest them (my parentheticals) too much (like this (and this))) they get confusing.'
def closing_paren_index( string, opening_paren_index )
depth = 1
partial = string.slice opening_paren_index + 1..-1
partial.each_char.with_index do |char, index|
if char == '('
depth += 1
elsif char == ')'
@celeryclub
celeryclub / element-queries.md
Last active January 14, 2016 17:37
Element Query talk

What are Element Queries?

  • Also called container queries
  • A way to change style based on element dimensions
  • Good for reusable components
  • They don't exist

The Problem with Element Queries

  • Circular dependencies
infile = ARGV[ 0 ]
words = File.readlines( infile )
# O(log n)
def rotation_index( array, lowest_so_far = nil, from = 0, to = nil )
lowest_so_far ||= array.first.downcase
to ||= array.size - 1
if from > to

Feature Branches

Start a branch for each new feature.

git checkout -b <branch>

Publish your branch and set up tracking.

git push -u origin 
@celeryclub
celeryclub / Setting up headless Raspberry Pi OS on macOS.md
Last active May 2, 2024 02:21
Setting up headless Raspberry Pi OS on macOS

Download the latest Raspberry Pi OS Lite image from https://www.raspberrypi.com/software/operating-systems/ (2022-04-04 at the time of this writing).

Insert your microSD card. Use Raspberry Pi Imager to burn the image to your microSD card. Make to select "Set username and password" in the config before starting. Name the user pi and select your own password.

Ensure the disk is mounted again, then enable SSH.

$ touch /Volumes/boot/ssh
@celeryclub
celeryclub / image.rb
Last active December 20, 2015 03:19
Example RailsAdmin configuration with a nested resource.
# app/models/image.rb
class Image < ActiveRecord::Base
belongs_to :term
def serializable_hash(options = nil)
hash = super
hash.delete_if { |k, v| v.blank? }
hash.delete('filename')