Skip to content

Instantly share code, notes, and snippets.

@reven
reven / living_room-ikea_dimmer.yaml
Last active November 29, 2020 07:05
Home Assistant - Dimming a light while holding down a button
---
#
# This automation simulates the use of the IKEA TRADFRI Wireless dimmer
# connected through zha but should also work for other type of events.
# Requires Home Assistant 0.113 or higher.
#
id: 'living_room-ikea_dimmer'
alias: IKEA Dimmer - Living Room
description: ''
mode: restart
@reven
reven / Configuration.h
Last active February 11, 2019 02:47
Marlin bugfix-2.0.x config for A6+MKS
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@reven
reven / gist:1b114a6e3a71c665119655ff62068315
Created December 9, 2017 03:43
Recover a USB drive with hidden partitions in Windows 10
I managed to do it with diskpart. What I was missing is the command to create a new partition. So here is a run-down of all the commands I used, step by step.
Beware that when typing select disk 1 (step 4), your disk number may be different. Selecting the incorrect disk might erase your whole computer's main disk drive, losing all your data on it.
I assume you know how to get to the Run prompt since you have arrived at SU. But if not, just press and hold down the Windows key on your keyboard. While still holding the Windows key, press the R key. Voilà! La Run prompt! L'invite de commande!
cmd
diskpart
list disk
select disk 1 (Careful! Choose the correct number here. See note above.)
@reven
reven / free_mem.sh
Created February 24, 2017 08:14
A script to get memory info in mac os x with only one call to vm_stat
#!/bin/sh
/usr/bin/vm_stat | sed 's/\.//' | awk '
/free/ {FREE_BLOCKS = $3}
/inactive/ {INACTIVE_BLOCKS = $3}
/speculative/ {SPECULATIVE_BLOCKS = $3}
/wired/ {WIRED_BLOCKS = $4}
END {
printf "Free: %s\n", ((FREE_BLOCKS+SPECULATIVE_BLOCKS)*4096/1048576)
printf "Inactive: %s\n", ((INACTIVE_BLOCKS)*4096/1048576)