Skip to content

Instantly share code, notes, and snippets.

@mvadu
mvadu / grafana custom.ini
Last active November 11, 2023 18:26
nginx config for using grafana, Influxdb via reverse proxy with authentication
# The full public facing url
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = http://localhost:80/grafana/
@mvadu
mvadu / ArchiveLogs.ps1
Last active January 26, 2023 04:15
Powershell script to archive daily monthly logs
#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 / Fetch-Resize-Image.ps1
Created June 30, 2017 04:07
Fetch images from various Web URLs and resize and save
[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 / upnpPortMapper.sh
Created March 30, 2019 02:13
THis script uses upnp client (upnpc) to talk to router and open ports
#!/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 / cpuFanControl.py
Created November 14, 2019 23:29
# 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
#!/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