Skip to content

Instantly share code, notes, and snippets.

John Ellis deckerego

View GitHub Profile
@deckerego
deckerego / fix_blender_282.sh
Created May 31, 2020
Fix Blender 2.82 permissions in MacOS
View fix_blender_282.sh
#!/bin/sh
sudo find /Applications/Blender.app -perm +111 -type f -exec chmod og+x {} \;
sudo find /Applications/Blender.app -type d -exec chmod og+x {} \;
@deckerego
deckerego / code.py
Last active Dec 15, 2019
Helper lamp with varying color temperature and brightness
View code.py
import analogio
import simpleio
import board
import time
import neopixel
import touchio
from digitalio import DigitalInOut, Direction, Pull
# NeoPixels
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
@deckerego
deckerego / code.py
Last active Dec 8, 2019
Use a remote control to change the lights on a Circuit Playground Express
View code.py
import pulseio
import board
import time
import neopixel
import touchio
import adafruit_irremote
from digitalio import DigitalInOut, Direction, Pull
power = True
color = (255, 255, 255)
@deckerego
deckerego / etc_cron.daily_backup
Last active Dec 4, 2019
Use the disk archiver (DAR) to perform a full backup every other month, otherwise create an incremental backup.
View etc_cron.daily_backup
#!/bin/bash
source /etc/default/backup
MONTH_TWO=$(date -d "- 2 month" '+%Y-%m')
MONTH_PREV=$(date -d "- 1 month" '+%Y-%m')
MONTH_NOW=$(date '+%Y-%m')
DATE=`date +%Y-%m-%d`
HOST=`hostname`
@deckerego
deckerego / code.py
Created Nov 5, 2019
Audio level meter with Circuit Playground Express
View code.py
import array
import math
import time
import neopixel
import audiobusio
import board
def avg(values):
return sum(values) / len(values)
@deckerego
deckerego / code.py
Created Nov 4, 2019
Create a campfire effect with a Circuit Playground Express. Copy a crackle.wav audio file for the sound effect, and toggle the switch to mute/unmute.
View code.py
from time import sleep
from random import random
from board import SPEAKER, SLIDE_SWITCH, SPEAKER_ENABLE, NEOPIXEL
from neopixel import NeoPixel
from digitalio import DigitalInOut, Direction, Pull
from audioio import WaveFile
from audioio import AudioOut
from simpleio import map_range
# NeoPixels
@deckerego
deckerego / code.py
Created Nov 2, 2019
Multi-sensor Feedback with Circuit Playground Express
View code.py
# Circuit Playground NeoPixel
import time
import board
import neopixel
import busio
import analogio
import digitalio
import simpleio
import adafruit_thermistor
import adafruit_lis3dh
@deckerego
deckerego / send_io.sh
Created Nov 15, 2015
Send Adafruit IO data using curl
View send_io.sh
#!/bin/sh
curl -H 'X-AIO-Key: feedfacedaedbeef' -H 'Content-Type: application/json' -X POST https://io.adafruit.com/api/feeds/myfeedname/data.json -d'{"value": 17}'
@deckerego
deckerego / findport.sh
Created Feb 21, 2019
Finding an unused port, starting at 1080
View findport.sh
netstat -aln | awk '
$6 == "LISTEN" {
if ($4 ~ "[.:][0-9]+$") {
len=split($4, a, /[:.]/);
port = a[len];
p[port] = 1
}
}
END {
for (i = 1080; i < 65000 && p[i]; i++){};
@deckerego
deckerego / slack.js
Created Sep 14, 2018
Send a Message to Slack
View slack.js
'use strict';
const https = require('https');
class Slack {
constructor(slackPath) {
this._options = {
hostname: "hooks.slack.com",
method: "POST",
path: slackPath,
You can’t perform that action at this time.