Skip to content

Instantly share code, notes, and snippets.

@dbcooper
dbcooper / wallpaper_rename.pl
Last active June 4, 2022 17:15
Stupid Q&D Perl script to rename Windows spotlight images [for wallpaper]. FMI https://www.cnet.com/tech/computing/where-to-find-the-windows-spotlight-photos/
#!/usr/bin/env perl
use v5.010;
use strict;
use warnings;
# From http://listofrandomwords.com/index.cfm?blist
my @keywords = qw(
hotspur
topnotch
@dbcooper
dbcooper / Matlab neural net object console dump.txt
Last active September 25, 2020 15:50
Matlab neural net stuff
>> net
net =
Neural Network
name: 'Function Fitting Neural Network'
userdata: (your custom info)
dimensions:
# See http://psc.edu/images/xsedetraining/BigData/Intro_To_Spark.pdf
rdd = sc.textFile("Complete_Shakespeare.txt")
print('Count number of lines:')
print(rdd.count())
print('Count number of words:')
words_rdd = rdd.flatMap(lambda x: x.split())
print(words_rdd.count())
@dbcooper
dbcooper / python_env.bat
Created December 12, 2016 08:34
Add Python directories to Windows command shell (cmd.exe)
@rem Base Python directory
@set PythonPath=%USERPROFILE%\AppData\Local\Programs\Python\Python35
@REM I'm assuming command extensions are off and Perl is installed :\
@REM Make temporary directory to hold new path information, since I have to set it through an intermediate file?
@cd %USERPROFILE%
@if not exist tmp mkdir tmp
@REM Add path(s) to environment path, keeping order but avoiding duplicates (I hope)
@echo Adding python command directories to the current environment:
package Authorization;
# My solution to exercise parts 1, 2, and 3 of http://marpa-guide.github.io/chapter3.html
use warnings;
use strict;
use Marpa::R2;
use Data::Dumper;
@dbcooper
dbcooper / confounding.pl
Created February 5, 2013 22:13
A confusing bit of code. YMMV.
# A few things have been renamed in an attempt to protect the innocent (and guilty)
package SomePackage;
use SomePackage;
sub LoadUnits {
return if $ser{'m'};
my($file) = "$SomePackage::HOME/etc/serunits.conf";
open(SERUNITS,"<$file") || return;
@dbcooper
dbcooper / per-user-telnet.reg
Last active December 15, 2025 17:37
Per-user telnet URL association for Windows
Windows Registry Editor Version 5.00
; Per-user telnet URL mapping
;
; Works w/ Firefox and Chrome under Windows 7
;
; Be sure to replace the path to PuTTY with the correct destination
;
[HKEY_CURRENT_USER\Software\Classes\telnet]
@dbcooper
dbcooper / Sample output
Created June 7, 2012 19:23
Parse logfiles
3 error(s) found in /u3/clerk/archive/2009/hydlab/hydlab-2009328.hyd
=============================» Parse Error «==============================
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (ond)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (SalCTempSp)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (pHS/cmCond)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (LDO%pptUnSal)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (LDOitspHL)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (Dep25SatmDO%)
#2012158+1946 hydscan[20199] header: (074 2009328+0430) ?unknown header designation (EBattg/lmeLDOD)
@dbcooper
dbcooper / form-helper-diff
Created December 16, 2011 18:21
Minor code modification
diff --git a/lib/HTML/FormHelpers.pm b/lib/HTML/FormHelpers.pm
index fba2ae6..30ba810 100644
--- a/lib/HTML/FormHelpers.pm
+++ b/lib/HTML/FormHelpers.pm
@@ -99,7 +99,7 @@ sub radio {
while ($i < @$values) {
my ($val,$disp) = @{$values}[$i, $i+1];
my $checked = $on eq $val ? 'checked="checked"' : "";
- push @ret, qq(<input type="radio" name="$fname" value="$val" $checked $attributes />$disp);
+ push @ret, qq(<label><input type="radio" name="$fname" value="$val" $checked $attributes />$disp</label>);