Skip to content

Instantly share code, notes, and snippets.

View Cougar's full-sized avatar
👨‍💻
I may be slow to respond.

Cougar

👨‍💻
I may be slow to respond.
View GitHub Profile
@Cougar
Cougar / linux.sh
Created January 11, 2017 11:21 — forked from marcan/linux.sh
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <[email protected]>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
#!/usr/bin/env python
import functools
from tornado.ioloop import IOLoop
from pymodbus.client.asynchronous import schedulers
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient
#from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient
from pymodbus120_async.client import AsyncModbusSerialClient
@Cougar
Cougar / cc128_mqtt_tornado.py
Created August 3, 2020 18:30
Python3 MQTT sender example
#!/usr/bin/python3
"""
Create database
curl -XPOST http://hostname:8086/query --data-urlencode 'q=CREATE DATABASE "cc128"'
"""
"""
DEBUG:asyncio:Using selector: EpollSelector
Socket opened
DEBUG:__main__:Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'cc128'
#!/bin/sh
if [ ! "$1" ]; then
echo "usage $0 domainlist" >&2
exit 1
fi
mkdir -p $HOME/docker-volumes/letsencrypt
docker run \
@Cougar
Cougar / priceswitch.yaml
Last active January 23, 2022 18:37
Home Assistant Blueprint: Automate switch based on energy price
blueprint:
name: Price Switch
description: Switch appliance on and off based on electricity price
domain: automation
source_url: https://gist.github.com/Cougar/2f7f87ac2dbbe84d892d6928cda898bd
input:
electricity_price_sensor:
name: Electricity price sensor
description: Electricity price tracking sensor (¢/kWh)
selector:
@Cougar
Cougar / vineerimaailm.user.js
Created August 18, 2023 16:49
Violentmonkey script to add m² price to plywood pricelist
// ==UserScript==
// @name Show m2 price - vineerimaailm.ee
// @namespace Violentmonkey Scripts
// @match https://vineerimaailm.ee/outlet
// @grant none
// @version 1.0
// @author Cougar
// @description 8/18/2023, 4:34:14 PM
// ==/UserScript==
@Cougar
Cougar / dz60_layout_60_iso_cougar.json
Created September 3, 2023 13:48
dz60_layout_60_iso_cougar.json
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "dz60",
"keymap": "dz60_layout_60_iso_cougar",
"layout": "LAYOUT_60_iso",
"layers": [
[
"QK_GESC",