Skip to content

Instantly share code, notes, and snippets.

View parasquid's full-sized avatar

Tristan parasquid

View GitHub Profile
@parasquid
parasquid / espruino.js
Created February 26, 2020 12:57
rgb mqtt
E.setClock(160);
var esp8266 = require("ESP8266");
console.log(esp8266.getState());
pinMode(D4, "output");
var numPixels = 8;
var server = "x.x.x.x";
var options = {
keep_alive: 60,
port: 1883,
@parasquid
parasquid / fog.rb
Created February 26, 2020 08:37
Do not run code during assets:precompile
# the condition checks if we're running inside rake assets:precompile
if !defined?(::Rake::SprocketsTask)
FOG_DIRECTORY = begin
# try and see if the directory exists
FOG_CONNECTION.directories.get(bucket_name)
rescue Excon::Error::Forbidden
# otherwise let's just create it
FOG_CONNECTION.directories.create(
key: bucket_name,
public: false,
@parasquid
parasquid / fizzbuzz.rb
Last active February 18, 2020 07:54
shortcircuit returning a value in a block
array = (1..100).map do |num|
return "fizzbuzz" if num % 3 == 0 && num % 5 == 0
return "fizz" if num % 3 == 0
return "buzz" if num % 5 == 0
num
end
puts array
@parasquid
parasquid / gist:4ae18d09e80e7248e37ab810b6b226e5
Created October 27, 2019 09:38
ATTiny85 SoftwareSerial and TinyWireS
https://forum.arduino.cc/index.php?topic=441428.0
#include "TinyWireS.h"
#define I2C_SLAVE_ADDR 0x25
#include "SoftwareSerial.h"
const int Rx = 3; // this is physical pin 2 - you do not need to connect this to DFPlayer
const int Tx = 4; // this is physical pin 3 - connect to RX pin on DFPlayer
SoftwareSerial mySerial(Rx, Tx);
7zip (v:19.00) [main]
arduino (v:1.8.10) [extras]
audacity (v:2.3.2) [extras]
firefox (v:70.0) [extras]
git (v:2.23.0.windows.1) [main]
hugo-extended (v:0.59.0) [main]
kicad (v:5.1.4_1) [extras]
nodejs (v:13.0.1) [main]
nvm (v:1.1.7) [main]
openssh (v:7.6p1) [main]
@parasquid
parasquid / Brewfile
Last active November 6, 2018 16:13
Brewfile
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
brew "autoconf"
brew "automake"
brew "coreutils"
brew "libyaml"
brew "readline"
brew "docker-compose"
@parasquid
parasquid / gist:5de4fa8ec49722a277b1d871015da767
Last active November 1, 2018 02:53
various docker services
# starts postgres
docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres
# starts postgres with timescaledb
docker run --name timescaledb -e POSTGRES_PASSWORD=postgres -p 5432:5432 timescale/timescaledb:1.0.0-pg10
@parasquid
parasquid / provision.ps1
Last active October 16, 2018 19:10
Windows setup
Set-MpPreference -ExclusionPath "$(Resolve-Path '~/')"
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
set-executionpolicy unrestricted -s cu
setx GOPATH %USERPROFILE%\golib;%USERPROFILE%\go
mkdir %USERPROFILE%\golib
mkdir %USERPROFILE%\go
scoop bucket add extras
scoop bucket add java
@parasquid
parasquid / hb links bookmarklet
Last active September 17, 2018 11:16
Generate Humble Bundle wget links (save as a bookmarklet)
@parasquid
parasquid / vagrant.rb
Created September 11, 2018 06:28 — forked from bjjb/vagrant.rb
A Capistrano 3.x Vagrant stage. Place into config/deploy/vagrant.rb, and deploy to the Vagrant box as if it were a production VM.
# Capistrano 3.x Vagrant stage
# config/deploy/vagrant.rb
set :stage, :vagrant
set :rails_env, "production"
vagrant_ssh_config = `vagrant ssh-config`.split("\n")[1..-1].map(&:strip).inject({}) do |m, s|
k, v = s.split(/\s/, 2).map(&:strip); m[k] = v; m
end