Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Frank syphernl

🚀
  • The Netherlands
View GitHub Profile
@syphernl
syphernl / ventilation.yaml
Last active May 8, 2021 — forked from SqyD/ventilation.yaml
ESPHome PWM fan using a Wemos D1 mini lite
View ventilation.yaml
# Controlling my Buva Qstream ventilation system using:
# * A Wemos D1 mini lite (an ESP8266 based board)
# * A Wemos power shield so I can power the Wemos from the ventilation units 12V supply.
# * A simple PWM to 10V convertor like this: https://www.cheaptech.nl/pwm-signaal-te-voltage-converter-1-3-khz-0-10-v-pw.html
# * The amazing ESPHome firmware tool: https://esphome.io
# * Home Assistant to tie it all together: https://www.home-assistant.io
#
# I used to use a Raspberry Pi and some Python code for this. See https://gist.github.com/SqyD/a927ab612df767a0cc892bcde23d025c
# The Wemos approach seems more stable and doesn't require external USB power.
@syphernl
syphernl / highstate_magic.py
Last active Sep 23, 2016
Saltstack MasterMinion show_highstate attempt
View highstate_magic.py
# -*- coding: utf-8 -*-
'''
Functions to interact with the state compiler on the master
'''
from __future__ import absolute_import
import pprint
# Import salt libs
import salt.utils.minion
@syphernl
syphernl / discover_vhosts.php
Created Dec 1, 2014
Low Level Discovery Userscript for Zabbix Agent
View discover_vhosts.php
#!/usr/bin/env php -n
<?php
function apache_vhosts($binary='/usr/sbin/apache2ctl')
{
$command = " -S 2>&1 | grep 'port ' | awk {'print $2,$4'} | sort -u -t' ' -k2,2 | grep -v 'localhost'";
$vhosts = shell_exec(sprintf("%s %s", $binary, $command));
$vhosts = explode("\n", trim($vhosts));
$results = array();
foreach($vhosts as $vhost)
@syphernl
syphernl / gist:25b901d343588ada6e7b
Last active Aug 29, 2015
Saltstack "eventbus" returner
View gist:25b901d343588ada6e7b
# -*- coding: utf-8 -*-
'''
Return data to a the Salt Eventbus.
Huh, that's default behavior isn't it? Technically yes.
But.. Not when you:
- use 'salt-call' on a minion
- use the Salt scheduler to execute periodically
Which means, the master doesn't get executed tasks in its job cache.
Very annoying if you want to create nice graphs of state executions.