Skip to content

Instantly share code, notes, and snippets.

@mvadu
mvadu / cpuFanControl.py
Created Nov 14, 2019
# This script is to control a fan via PWM signal on GPIO14. I have a MOSFET acting as a low side switch connected to this pin It measures the temperature, and if it corosses a set limit turns on the fan. The fan speed will be relative to temperature Once the temperature goes down fan will be turned off, it also logs it to a local influx DB
View cpuFanControl.py
#!/usr/bin/env python
#~/.local/bin/cpuFanControl.py
#################################################################################
# This script is to control a fan via PWM signal on GPIO14
# I have a MOSFET acting as a low side switch connected to this pin
# It measures the temperature, and if it corosses a set limit turns on the fan
# The fan speed will be relative to temperature
# Once the temperature goes down fan will be turned off
# it also logs it to a local influx DB
@mvadu
mvadu / upnpPortMapper.sh
Created Mar 30, 2019
THis script uses upnp client (upnpc) to talk to router and open ports
View upnpPortMapper.sh
#!/bin/bash
#~/bin/upnpPortMapper.sh
#sudo apt-get install miniupnpc
#crontab -l | grep upnp || echo $(crontab -l ; echo '*/5 * * * * ~/bin/upnpPortMapper.sh >/dev/null 2>&1') | crontab -
export LC_ALL=C
router=$(ip r | grep default | cut -d " " -f 3)
gateway=$(upnpc -l | grep "desc: http://$router:[0-9]*/rootDesc.xml" | cut -d " " -f 3)
ip=$(upnpc -l | grep "Local LAN ip address" | cut -d: -f2)
@mvadu
mvadu / Fetch-Resize-Image.ps1
Created Jun 30, 2017
Fetch images from various Web URLs and resize and save
View Fetch-Resize-Image.ps1
[CmdletBinding()]
param (
[ValidateNotNullOrEmpty()]
[string] $ConfigPath = ".\RefreshWebCache.json"
)
begin{
Write-Host "$([datetime]::now.tostring()) Starting $(split-path -Leaf $MyInvocation.MyCommand.Definition ) process"
Add-Type -AssemblyName System.Drawing
@mvadu
mvadu / ArchiveLogs.ps1
Last active Jul 19, 2020
Powershell script to archive daily monthly logs
View ArchiveLogs.ps1
#ref: http://purple-screen.com/?p=440
#ref: https://gallery.technet.microsoft.com/scriptcenter/31db73b4-746c-4d33-a0aa-7a79006317e6
[CmdletBinding()]
param (
#Test Mode will not remove any files, does a what-if
[switch] $TestMode = $true,
#Log folder location
[parameter(Mandatory=$true)]
[alias("source")]
[string]$Folder,
@mvadu
mvadu / grafana custom.ini
Last active May 5, 2022
nginx config for using grafana, Influxdb via reverse proxy with authentication
View grafana custom.ini
# The full public facing url
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = http://localhost:80/grafana/