Skip to content

Instantly share code, notes, and snippets.

@dbdness
dbdness / digispark-attiny85-mac-setup.md
Last active June 26, 2024 20:38
DigiSpark Kickstarter ATTINY85 Setup on macOS + Hello World

Digispark ATTINY85 Initial Setup on macOS + Hello World

Originally written in January 2021.

Originally written for macOS Big Sur 11.1

Step 1: Acquire a DigiSpark ATTINY85 Board

Board used for this guide is the Kickstarter version.

Step 2: Download the Arduino IDE

Version at the time of writing is 1.8.13

@leepa
leepa / buildspec.yml
Last active March 8, 2024 20:15
A buildspec for CodeBuild... for cross platform building with buildx - enjoy :)
version: 0.2
phases:
install:
runtime-versions:
docker: 19
commands:
- docker version
- curl -JLO https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64
- mkdir -p ~/.docker/cli-plugins
@savetheclocktower
savetheclocktower / laundry-spy.ino
Last active August 12, 2018 21:38
Laundry Spy firmware
// (see the blog post at https://andrewdupont.net/2018/04/27/laundry-spy-part-3-the-software/)
// GENERAL CONFIG
// ==============
// The baud rate of serial output for logging. If necessary, change the baud
// rate in your Serial Monitor to match this.
#define BAUD_RATE 115200
// The name by which this device will identify itself over mDNS (Bonjour).
@msdotnetclr
msdotnetclr / redis-conditional-set.txt
Last active April 1, 2024 13:26
Redis LUA: set or update key if new value is higher/lower than current
# Basic benchmarks
# SET key val # 87489.06
# SETRANGE key2 6 "Redis" # 75757.58 req/s
# INCR key 245 # 70224.72 req/s
# INCRBY key 245 22 # 67114.09 req/s
# EVAL SET key val # 46296.29 req/s
# SETIFHIGHER (set or update key if new value is higher than current) # 41666.67 req/s
# if not exists return OK , if updated return the increment , if not updated return 0
SCRIPT LOAD "local c = tonumber(redis.call('get', KEYS[1])); if c then if tonumber(ARGV[1]) > c then redis.call('set', KEYS[1], ARGV[1]) return tonumber(ARGV[1]) - c else return 0 end else return redis.call('set', KEYS[1], ARGV[1]) end"
@davidejones
davidejones / get_s3_file.sh
Last active July 17, 2024 17:34
curl get file from private s3 with iam role
#!/bin/bash
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | sed -n '/Token/{p;}' | cut -f4 -d'"'`
file="somefile.deb"
bucket="some-bucket-of-mine"
date="`date +'%a, %d %b %Y %H:%M:%S %z'`"
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active June 30, 2024 04:14
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@bpo
bpo / eval-hello.sh
Last active November 2, 2022 19:26
Redis Lua examples
redis-cli EVAL "$(cat hello.lua)" 0