Skip to content

Instantly share code, notes, and snippets.

View mohclips's full-sized avatar

mohclips mohclips

View GitHub Profile
@mohclips
mohclips / esp8266_sensor.ino
Created January 30, 2021 11:08
A temperature, pressure, humidity sensor (BME280), with webserver, syslog and mqtt
/*
* Based in part on https://lastminuteengineers.com/bme280-esp8266-weather-station/
*
* massively tweaked by me :)
*/
/*
* BME280 Room Sensors
*
* 00F50507 - room1
@mohclips
mohclips / settings.json
Created January 27, 2021 21:44
relieve the developer of the curmudgeon of golint
"go.useLanguageServer": true,
// gometalinter is not allowed but works?
"go.lintTool": "gometalinter",
"go.lintFlags": [
"--disable-all",
"--enable=golint",
"--exclude=exported (const|type|method|function) [\\w.]+ should have comment (\\(or a comment on this block\\) )?or be unexported",
"--exclude=don't use ALL_CAPS in Go names; use CamelCase",
"--exclude=(func|const|struct field|) \\w+ should be \\w+"
]
@mohclips
mohclips / text.sh
Last active March 25, 2024 06:11
Enable - Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
# EDIT - 01 Dec 2023 - Works without the below in Ubuntnu 22.04
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 040: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 044: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# get the pre-compiled driver
@mohclips
mohclips / main.go
Last active January 13, 2021 22:59
split bitmask into names
package main
import (
"fmt"
)
var FlagsToNames = map[int]string{
0x0: "read",
0x1: "write",
0x2: "deny",
@mohclips
mohclips / syncthing
Created December 18, 2020 17:22
init script for Terramaster NAS F2-220
#!/bin/bash
#
# /etc/rc.d/init.d/syncthing
#
# Starts the syncthing daemon on TerraMaster NAS
#
# chkconfig: 345 80 20
# description: the syncthing daemon
# processname: syncthing
# config: /etc/syncthing.conf
@mohclips
mohclips / docker-compose.yml
Created November 14, 2020 20:44
How to define a container on the Local LAN
---
version: "2.4"
services:
test_localnet_ip:
image: alpine:latest
container_name: test_localnet_ip
command: tail -F anything
@mohclips
mohclips / deg_to_nesw.sql
Created August 20, 2020 22:49
sql frunction to convert degrees to N E S W compass points
DROP FUNCTION IF EXISTS deg_to_nesw;
DELIMITER //
CREATE FUNCTION deg_to_nesw(deg float) RETURNS char(3) DETERMINISTIC
-- based on: https://www.campbellsci.eu/blog/convert-wind-directions
BEGIN
SET @directions = 'N,NNE,NE,ENE,E,ESE,SE,SSE,S,SSW,SW,WSW,W,WNW,NW,NNW,N';
RETURN substring_index(substring_index(@directions,',',Round((deg MOD 360)/ 22.5,0)+1),',', -1);
END
//
@mohclips
mohclips / .tmux.conf
Created June 5, 2020 22:32
tmux settings
#picked these up somewhere a long time back
# Tmux settings
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# Enable mouse control (clickable windows, panes, resizable panes)
set -g mouse-select-window on
set -g mouse-select-pane on
set -g mouse-resize-pane on
@mohclips
mohclips / configmap-test.yml
Created January 8, 2020 22:28
k8s configmap example
---
kind: ConfigMap
apiVersion: v1
metadata:
name: example-configmap
data:
# Configuration values can be set as key-value properties
# use '|' bar to add new line to each line, otherwise its missed out
database: |
mongodb
@mohclips
mohclips / ansible_json_test.yml
Created January 8, 2020 15:34
Ansible json test
---
# vim: set ft=ansible ts=2 sw=2 et:
- hosts: localhost
gather_facts: no
connection: local
become: no
vars:
my_json: |