Skip to content

Instantly share code, notes, and snippets.

View stigtsp's full-sized avatar
🕊️
peace, pls

Stig stigtsp

🕊️
peace, pls
View GitHub Profile
git log -1000 --pretty="format:%ai%%%ae%%%s" --abbrev-commit --date=local

Keybase proof

I hereby claim:

  • I am stigtsp on github.
  • I am sgo (https://keybase.io/sgo) on keybase.
  • I have a public key ASAt9v_4tDFD4RAsNoFM5kN93SbQG8efeZrvjpxeDhUuCwo

To claim this, I am signing this object:

@stigtsp
stigtsp / dsl.15m.py
Created November 30, 2016 07:44
Is anyone at Dim Sum labs? This Bitbar scripts will tell you if the lights are on, and what rgb value the light has.
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import paho.mqtt.client as mqtt
import json
import struct
def on_connect(client, userdata, flags, rc):
client.subscribe("dsl/enviro")
@stigtsp
stigtsp / gist:160567cdd265c67fafb09b1c47120fb9
Last active December 25, 2017 03:42
micropython WeMos D1
# need usb-serial driver on macos
SERIAL=/dev/cu.wchusbserial1410
wget http://micropython.org/resources/firmware/esp8266-20170108-v1.8.7.bin
esptool.py --port $SERIAL write_flash -fm dio -fs 32m -ff 40m 0x00000 esp8266-20170108-v1.8.7.bin
http://garybake.com/getting-started-with-the-wemos-d1-and-micropython.html
@stigtsp
stigtsp / debian_8_caddy.sh
Last active April 4, 2017 21:07 — forked from Nixtren/debian_8_caddy.sh
Debian 8 (Jessie) with Caddy & PHP 7.0 from scratch
#!/bin/bash
# This is my personal recipe to put a Caddy webserver running on Debian 8 (Jessie) from scratch.
# This installs some unrelated stuff as well, such as fail2ban, dstat... Feel free to modify it to your needs.
# Run: wget https://gist.githubusercontent.com/Nixtren/ae34d0308355884b9c7431ecab699eb4/raw -O /dev/stdout | bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_freq 80m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x37E000 blank.bin

@stigtsp
stigtsp / CCS811.js
Last active January 27, 2018 21:43
/* Copyright (c) 2018 Gordon Williams, Pur3 Ltd. See the file LICENSE for copying permission. */
var C = {
WHO_AM_I : 0x20,
WHO_AM_I_VALUE : 0x81,
STATUS : 0x00,
STATUS_ERROR : 0x01,
STATUS_DATA_READY : 0x08,
STATUS_APP_VALID : 0x10,
docker run --restart=always -p80:80 -p443:443 -v /root/.caddy:/root/.caddy -v/srv:/srv:ro -v/etc/Caddyfile:/etc/Caddyfile:ro orbsmiv/caddy-rpi:latest
@stigtsp
stigtsp / convert_innodb_to_tokudb.fish
Created June 6, 2018 10:52
mysql: convert all innodb tables to tokudb
set DATABASE name_of_database_goes_here
for table in (mysql $DATABASE -NBe "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE engine = 'InnoDB' and table_schema='$DATABASE'");
echo "alter table $DATABASE.$table engine=tokudb;";
end