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 / 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",
@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 / 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:
#!/bin/sh
if [ ! "$1" ]; then
echo "usage $0 domainlist" >&2
exit 1
fi
mkdir -p $HOME/docker-volumes/letsencrypt
docker run \
@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'
#!/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 / 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
Life is short, as everyone knows. When I was a kid I used to wonder about this. Is life actually short, or are we really complaining about its finiteness? Would we be just as likely to feel life was short if we lived 10 times as long?
Since there didn't seem any way to answer this question, I stopped wondering about it. Then I had kids. That gave me a way to answer the question, and the answer is that life actually is short.
Having kids showed me how to convert a continuous quantity, time, into discrete quantities. You only get 52 weekends with your 2 year old. If Christmas-as-magic lasts from say ages 3 to 10, you only get to watch your child experience it 8 times. And while it's impossible to say what is a lot or a little of a continuous quantity like time, 8 is not a lot of something. If you had a handful of 8 peanuts, or a shelf of 8 books to choose from, the quantity would definitely seem limited, no matter what your lifespan was.
Ok, so life actually is short. Does it make any difference to know that
{
"success": true,
"itemTemplates": [
{
"templateId": "BADGE_BATTLE_ATTACK_WON",
"badgeSettings": {
"badgeType": "BADGE_BATTLE_ATTACK_WON",
"badgeRank": 4,
"targets": [
10,
@Cougar
Cougar / gist:0f8b4bc028df9856b7af6fad018bff2e
Created June 4, 2016 21:26
Add new subtitle to MKV file
ffmpeg -i source.mkv -f srt -i source.srt -map 0 -c:v copy -c:a copy -scodec copy -map 1 -scodec srt -metadata:s:s:10 language=est new.mkv