Skip to content

Instantly share code, notes, and snippets.

View beanieboi's full-sized avatar

Ben Fritsch beanieboi

View GitHub Profile
@beanieboi
beanieboi / Airrohr.yaml
Created November 25, 2022 18:16
Running Airrohr/Luftdaten Sensor (luftdaten.info) with ESPHome
esphome:
name: airrohr
platform: ESP8266
board: nodemcuv2
# Enable logging
logger:
level: WARN
# Enable Home Assistant API
@beanieboi
beanieboi / ecotrend.rb
Created May 26, 2022 11:58
ISTA Ecotrend
require "bundler"
Bundler.setup
require 'json'
require 'excon'
# get token
login_response = Excon.post('https://api.prod.eed.ista.com/login',
body: '{"email":"email", "password":"password","fromMobileApp":true}',
headers: { "Content-Type" => "application/json" }
)
@beanieboi
beanieboi / cortex.sh
Last active December 26, 2021 09:02
Cortex Metrics FreeBSD rc.d script
#!/bin/sh
# PROVIDE: cortex
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable cortex:
#
# cortex_enable (bool): Set to "NO" by default.
@beanieboi
beanieboi / home assistant.yml
Last active June 6, 2022 03:09
HomeAssistant Luftdaten REST API - Air Quality, PM2.5, PM10, Temp and Humidity (SDS011 and DHT22)
sensor:
- platform: rest
name: luftdaten
resource: http://192.168.1.149/data.json
scan_interval: 100
json_attributes:
- sensordatavalues
value_template: '{{ value_json.age }}'
- platform: template
sensors:
@beanieboi
beanieboi / batch-updates.sql
Last active March 11, 2019 12:25
My Postgres Cheatsheet
DO LANGUAGE plpgsql $$
DECLARE counter INTEGER = 1;
DECLARE tick INTEGER = 1;
BEGIN
WHILE counter > 0 LOOP
UPDATE table
SET field = NULL
WHERE id IN (
SELECT id
FROM table
mkdir /tmp/zroot
zpool import -fR /tmp/zroot zroot
mkdir /tmp/root
mount -t zfs zroot/ROOT/default /tmp/root
#!/home/rof/.rvm/rubies/ruby-2.2.0/bin/ruby
require 'json'
require 'net/http'
class CodeshipRestartBuild
def self.restart_build
self.new.restart_build
end
package bitmask
import (
"encoding/binary"
"bytes"
"fmt"
)
type Channelmask struct {
A3 bool
@beanieboi
beanieboi / wifi.json
Last active January 22, 2016 19:09
Hackerbeach Wifi Passwords
{
"places": [
{
"name": "Surf Shak",
"SSID": "Bar Surf",
"password": "shak2525"
},
{
"name": "Hostal Rutamar",
"SSID": "HOSTAL RUTAMAR",
NoMethodError at /merchants/xxx/transparent_redirect_requests
undefined method `[]' for nil:NilClass
file:
base.rb
location: html?
line:
117
BACKTRACE
(expand)
JUMP TO: