Skip to content

Instantly share code, notes, and snippets.

@chrispruitt
chrispruitt / bt_speaker-raspberry_pi-zero_w.md
Created January 28, 2019 03:11 — forked from actuino/bt_speaker-raspberry_pi-zero_w.md
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 http://www.actuino.fr/ 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.

#Headless Setup of Raspberry Pi Zero W (Raspberry Pi 3 Wireless) (macOS)

  1. Formatt the Micro SD card - Open a terminal and type 'diskutil list'. Find your card and copy the disk name (For example: /dev/disk4). Format the card with diskutil eraseDisk ExFat temp disk4(Use your disk here)
  2. Download Raspbian - wget https://downloads.raspberrypi.org/raspbian_lite_latest
  3. Unmount the SD card - diskutil unmountDisk /dev/disk4 or whatever your disk path is
  4. Mount the Raspbian image to the card - sudo dd if=PATH-TO-RASPBIAN-IMAGE of=/dev/disk4` or whatever your disk path is
  5. Enable SSH on the Pi - cd /Volumes && ls. You should see a boot partition from the SD card cd boot && touch ssh
  6. Setup WiFi on the PI - While still in the boot partition add a wpa_supplicant.conf file with your wifi configurations (example is attached)
  7. Boot the PI - Unmount the card diskutil unmountDisk /dev/disk4 (or whatever your disk path is) and put it in the Pi, then power up the Pi
@chrispruitt
chrispruitt / arrange-windows.applescript
Last active August 28, 2019 12:43 — forked from cmackay/gist:5863257
AppleScript to save and restore window position and sizes.
-- allSettings is a list of records containing {width:? height:? apps:{{name:? pos:? size:?},...}
-- for each display setup store the apps and their associated position and size
property allSettings : {}
-- create a variable for the current settings
set currentSettings to {}
display dialog "Restore or save window settings?" buttons {"Restore", "Save"} default button "Restore"
set dialogResult to result
@chrispruitt
chrispruitt / maintenance.html
Last active August 28, 2019 12:42 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@chrispruitt
chrispruitt / generate_atlantis_yaml.sh
Last active February 18, 2020 13:15
Auto generate atlantis.yaml file for terraform repository
#!/bin/bash
# Run this file at the root level of your terraform repo to generate your basic atlantis.yaml file
# This file is somewhat specific to my needs so it will probably need some tweaking for your own terraform setup
ATLANTIS_YAML="atlantis.yaml"
TERRAFORM_VERSION="v0.11.11"
WORKSPACES="dev tst stg prd"
touch ${ATLANTIS_YAML}
@chrispruitt
chrispruitt / .block
Last active August 15, 2019 17:08
Simple Toggle Button
license: mit

Keybase proof

I hereby claim:

  • I am chrispruitt on github.
  • I am chrispruitt (https://keybase.io/chrispruitt) on keybase.
  • I have a public key ASBo_a5u69MkO2iWWcFY3WCxbGA79O-aL2wNSJ_RQr1ADwo

To claim this, I am signing this object:

#!/usr/bin/env bash
# This file is to be run at the root of a git repo.
# It simply symlinks any .sh files in a .githooks/ directory to the .git/hooks directory,
# effectively installing your versioned git hooks.
# create .git/hooks directory if not exists
(
cd .git || exit 1
mkdir -p hooks
@chrispruitt
chrispruitt / Dockerfile
Created February 5, 2021 01:22 — forked from dariodip/Dockerfile
Cython in a Docker container
FROM python:3.6
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
RUN python setup.py build_ext --inplace
ENTRYPOINT ["python"]
CMD ["app.py"]
awssso() {
# requires:
# - aws cli v2
if [[ -z "$AWS_CONFIG_FILE" ]]
then
local AWS_CONFIG_FILE=~/.aws/config
fi
export AWS_PROFILE=${1}