Skip to content

Instantly share code, notes, and snippets.

View beauwilliams's full-sized avatar
🧑‍💻
Open sourcing it

Beau beauwilliams

🧑‍💻
Open sourcing it
View GitHub Profile
@beauwilliams
beauwilliams / sonoff_snzb01_wireless_switch_z2m.yaml
Last active March 4, 2023 02:19
sonoff_snzb01_wireless_switch_z2m.yaml
blueprint:
name: Zigbee2MQTT - Sonoff SNZB-01 Zigbee Wireless Switch
description: Automate your Sonoff SNZB-01 Zigbee Wireless Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Sonoff SNZB-01 Zigbee Wireless Switch
description: Sonoff SNZB-01 Zigbee Wireless Switch to use
selector:
entity:
blueprint:
name: Zigbee2MQTT - Tuya 4-Button Scene Switch Fixed
description: Automate your Tuya 4-Button Scene Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Tuya 4-Button Scene Switch
description: Tuya 4-Button Scene Switch to use
selector:
entity:
@beauwilliams
beauwilliams / Vagrant-M1-Install.bash
Last active November 8, 2024 17:55
Run x86 VM's on Mac M1 arm using vagrant with qemu hypervisor
brew install vagrant qemu
#Due to dependency errors, we must install vbguest first..
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-qemu
#cd to working dir you like to keep your vagrant files
cd ~/VM-and-containers/VagrantMachines/M1-vagrantfiles/ubuntu18-generic-64/
#Create a vagrant file
$EDITOR Vagrantfile
@beauwilliams
beauwilliams / safe_require_nvim.lua
Last active May 13, 2024 13:23
A simple function to safely require packages. Avoids vim crashing when packages not installed
-- @USAGE:
-- local foo = safe_require('foo')
-- if not foo then return end
_G.safe_require = function(module_name)
local package_exists, module = pcall(require, module_name)
if not package_exists then
vim.defer_fn(function()
vim.schedule(function()
vim.notify('Could not load module: ' .. module_name, 'error', { title = 'Module Not Found' })
end)
@beauwilliams
beauwilliams / allocation-example.sol
Created March 12, 2022 00:00
A demonstraction of a claimable allocation contract for MACS
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
@beauwilliams
beauwilliams / vesting-example.sol
Created March 11, 2022 23:55
A demonstraction of a linear vesting contract for MACS
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);