Coding on Live Average https://liveaverage.com/categories/coding/ Recent content in Coding on Live Average Hugo -- gohugo.io en-us Mon, 20 Apr 2020 00:00:00 +0000 Tesla Powerwall Dashboard https://liveaverage.com/projects/tesla-powerwall-dashboard/ Mon, 20 Apr 2020 00:00:00 +0000 https://liveaverage.com/projects/tesla-powerwall-dashboard/ Tesla Powerwall Dashboard This is based on the work of @rhodesman and his teslaPowerDash repo, but hopefully enables easier ramp up to start obtaining and trending Powerwall 2 API data. Usage If you&rsquo;re still using docker rather than podman, simply replace all podman calls with docker. Pull the container image: podman pull liveaverage/powerwall-dashboard Start the container, replacing POWERWALL_IP with the assigned IP address of your Powerwall and LOCAL_INFLUXDB_PATH with an appropriate destination to store trend data: export POWERWALL_IP=192. Mermaid + Hugo https://liveaverage.com/projects/integration-mermaid/ Wed, 20 Jun 2018 00:00:00 +0000 https://liveaverage.com/projects/integration-mermaid/ mermaidjs I love my Hugo theme from jpescador , but it was missing mermaidjs&hellip; I wanted the same shortcode integration available in some other themes, but I also wanted to leverage a CDN for libary loads and make the theme easily swappable from the shortcode calls. So: {{&lt; mermaid align=&#34;left&#34; theme=&#34;dark&#34; &gt;}} graph LR; A[Hard edge] --&gt;|Link text| B(Round edge) B --&gt; C{Decision} C --&gt;|One| D[Result one] C --&gt;|Two| E[Result two] {{&lt; /mermaid &gt;}} now renders: Making Cisco Identity Firewall, CDA, and ISE play nice https://liveaverage.com/features/coding/making-cisco-identity-firewall-and-ise-play-nice/ Thu, 07 Aug 2014 14:03:32 +0000 https://liveaverage.com/features/coding/making-cisco-identity-firewall-and-ise-play-nice/ As of Cisco CDA Patch 2, identity mappings provided via Cisco ISE are natively supported. This means you can authenticate against ISE, which may in turn authenticate against LDAP or Active Directory, and subsequently notify one or more Cisco CDA servers that a new user-to-IP mapping exists. Cisco accomplishes this exchange of authenticated identities via syslog messages. ISE is configured to forward syslog messages to the CDA server(s), and the CDA server(s) have the sending ISE server(s) configured as a syslog “client. Powershell: Bulk provision DHCP Scopes https://liveaverage.com/features/coding/powershell-bulk-provision-dhcp-scopes/ Wed, 30 Jul 2014 21:08:10 +0000 https://liveaverage.com/features/coding/powershell-bulk-provision-dhcp-scopes/ Thought I’d share a nice wrapper for netsh and dnscmd calls to allow easy, bulk provisioning of new DHCP scopes. It’s nice being able to provision a ton of these at once by piping the output from Import-CSV!  ############################ #AUTHOR: JR Morgan #CREATED: 20120417 #MODIFIED: 20140611 ############################ &lt;# .Synopsis Adds DHCP Scope to ALL specified DHCP servers. If split-scope is desired the script uses IP Math to automatically add the desired exlcude ranges. Check_MK: Local Checks Grab Bag! https://liveaverage.com/features/coding/check_mk-local-checks-grab-bag/ Tue, 29 Jul 2014 15:32:29 +0000 https://liveaverage.com/features/coding/check_mk-local-checks-grab-bag/ Some local Check_MK checks that were created to execute check_MK local check scripts (Powershell) in 64-bit context, monitor Exchange 2007 health (Storage Group replication status, Log Truncation after backups, etc.), and monitor DNS scavenging on Windows servers: @echo off REM Note that SysNative is available on x86 2008, and on x86 2003 with KB942589 applied set CONSOLE_WIDTH=500 CD %ProgramFiles(x86)%\check_mk\local-64 FOR /R %%X IN (&quot;*&quot;) DO ( %WINDIR%\SysNative\windowspowershell\v1.0\powershell.exe -File &ldquo;%%X&rdquo;) Execute-Local-64.bat view raw $Host. Powershell Script: Sync DHCP Reservations (Windows Server 2008) https://liveaverage.com/features/coding/powershell-script-sync-dhcp-reservations-windows-server-2008/ Wed, 14 Nov 2012 14:11:56 +0000 https://liveaverage.com/features/coding/powershell-script-sync-dhcp-reservations-windows-server-2008/ If you have redundant Windows 2008 DHCP servers (likely with split-scope configurations), you’re familiar with the problem of keeping reservations between the servers synchronized. I figured I’d post a script I created to sync reservations between servers. Synchronization can be 1-to-1 or 1-to-many, depending on your redundant DHCP server configuration. This script can sync with ALL authorized DHCP servers in a domain if needed. Make sure to read the included Powershell help information. Powershell Script: Windows Event Log Retention and Compression https://liveaverage.com/features/coding/powershell-script-windows-event-log-retention-and-compression/ Wed, 07 Nov 2012 22:12:34 +0000 https://liveaverage.com/features/coding/powershell-script-windows-event-log-retention-and-compression/ Windows Security event logs fill up fast when you have Directory Service Access Auditing enabled, for whatever reason. If I want to retain any useful information, I need at least 7 to 14 days of logs to review, in my case, the DNS scavenging process. The built-in ‘Archive log when full’ option doesn’t really help out as much as you’d think, particularly when I might have 2 or 3 logs (each 300MB) per day. Nagios Plugin: Windows Server DHCP Scopes Usage Monitoring https://liveaverage.com/news/nagios-plugin-windows-server-dhcp-scopes-usage-monitoring/ Fri, 13 Apr 2012 16:03:59 +0000 https://liveaverage.com/news/nagios-plugin-windows-server-dhcp-scopes-usage-monitoring/ I’ve stumbled on a useful plug-in from Lars Michelsen that easily monitors a single Windows Server DHCP scope for usage using SNMPv2, but found this fell short of what I needed for monitoring several scopes at once. I’ve modified Lars’ original plugin/script to accommodate all available DHCP scopes on your monitored Windows server. You no longer need to add separate service definitions to monitor all available scopes. It’s worth noting a couple of important details: Managing backup retention… with one line of Powershell https://liveaverage.com/features/coding/managing-backup-retention-with-one-line-of-powershell/ Wed, 30 Nov 2011 18:09:08 +0000 https://liveaverage.com/features/coding/managing-backup-retention-with-one-line-of-powershell/ <p>Ok, I used four lines, but my needs for retention might be a bit more complex than most. I also spaced each pipeline command, so it looks longer than it should, but readability is important. Additionally, there’s a good half-page of comments in the script than can safely be ignored, unless you <em>want</em> to know what was going through my mind. Most of these related directly to my desired retention periods.</p> <p>For testing purposes, the last two “lines” only print out the listing of files that would be deleted.</p> OpenFiler errors that only I seemed to experience… https://liveaverage.com/features/coding/openfiler-errors-that-only-i-seemed-to-experience/ Tue, 26 Jul 2011 16:51:03 +0000 https://liveaverage.com/features/coding/openfiler-errors-that-only-i-seemed-to-experience/ Well, I’ve finally deployed some production Openfiler ESA 2.99.1 machines as home-brew iSCSI boxes, primarily used for backups or low-stress virtual storage. Yes, they’re great — my basic write speeds on a Core 2 Duo box (recycled Dell Precision 390 workstation with 2GB of RAM and a single 1TB drive *no* RAID): [shell] administrator@mail:/backup-iscsi$ sudo dd if=/dev/zero of=garbage bs=131072 count=20000 20000+0 records in 20000+0 records out 2621440000 bytes (2.6 GB) copied, 40. Add ‘Submitted Tickets’ Listing Page for Joomla! RSTickets https://liveaverage.com/features/coding/add-submitted-tickets-listing-page-for-joomla-rstickets/ Fri, 10 Jul 2009 17:15:21 +0000 https://liveaverage.com/features/coding/add-submitted-tickets-listing-page-for-joomla-rstickets/ <p><img class="alignright" title="Joomla!" src="http://cdn.joomla.org/images/logo.png" alt="" width="235" height="46" /></p> <p>If you haven’t heard, <a title="Check out the RSTickets! extension from RSJoomla!" href="http://www.rsjoomla.com/joomla-components/rstickets.html" target="_blank">RSTickets!</a> is an advanced Joomla! Help Desk ticketing system that allows you (or a team of yous) to manage and keep track of your clients’ issues. It’s actually one of the few effective, useful Help Desk systems available for the Joomla! 1.5+ framework that I would personally recommend. Unfortunately, it’s still under development and lacks certain features that one may desire, such as a read-only listing page that displays tickets already submitted to you or your department.</p> Altermime, Postfix/Zimbra, and Headaches https://liveaverage.com/features/coding/altermime-postfixzimbra-and-headaches/ Wed, 24 Jun 2009 19:43:11 +0000 https://liveaverage.com/features/coding/altermime-postfixzimbra-and-headaches/ <blockquote> <p><em>EDIT: I have since removed altermime after installing a MailScanner spam relay for our Zimbra server to use. Because, by default, MailScanner appends a default signature to all outbound email, it was very simple to modify the signature rules to accomodate our mandatory disclaimers for different domains.</em></p> </blockquote> <p>I had the pleasure of applying mandatory disclaimers to all [outbound] emails at my workplace today… ~Joy~ … I had the assumption it’d be rather easy, but Altermime and Postfix were a bit finicky to work with. After editing the <strong>master.cf</strong> I ended up customizing my own ‘disclaimer’ shell script.</p> Bashing MySQL Dumps https://liveaverage.com/features/coding/bashing-mysql-dumps/ Tue, 29 Jul 2008 14:45:14 +0000 https://liveaverage.com/features/coding/bashing-mysql-dumps/ <p>A quick set of batch scripts I wrote up (two of the three scripts, anyway) for dumping all of my (specified) MySQL databases into an archive for backup. The log mailing (<strong>emailsql.pl</strong>)requires Perl and the MIME:Lite module to correctly function. I’ve also utilized a wrapper script so the log outputs to a separate file [to be mailed]. There’s also a ‘dummy’ log file I use in my crontab file, though this isn’t really necessary:</p> Perl my way to happiness https://liveaverage.com/features/coding/perl-my-way-to-happiness/ Fri, 25 Apr 2008 19:00:49 +0000 https://liveaverage.com/features/coding/perl-my-way-to-happiness/ If only everything was as easy &amp; straight-forward as account provisioning in Zimbra: [shell]!/usr/bin/perl # ZCS IMPORT SCRIPT # Provided by : ZCS Wiki # Modified by : J.R. # Last Change : 2008.04.09 # Lookup the valid COS (Class of Service) ID in the interface or like this my $cosid = `su – zimbra -c ‘zmprov gc apd |grep zimbraId:’`; $cosid =~ s/zimbraId:\s*|\s*$//g; while (&lt;&gt;) { chomp; # CHANGE ME: To the actual fields you use in your CSV file