Code Dump: Icongen

Here’s a quick and dirty php script (using GD) that creates icons for my android phone. I got fed up at SimpleText, which no longer creates transparent images, and appears to have been abandoned by its developer. Images are created from the URL

icongen.php?name=ICON

into a

OSHA Label Generator

label

OSHA Label Generator
This is something I whipped up yesterday afternoon/this morning after an employee requested I help him create a template for OSHA labels, as apparently OSHA standards have changed or something. As he described what he wanted, I knew that it would be painful to create in

Recovering Private Key for a CRT file in Windows Server

To summarize what is here

  1. Import Certificate via MMC
  2. Get “serial number” of certificate
  3. certutil –repairstore my SERIAL
  4. Refresh certificate store and check for private key. If there isn’t one, you’ll need to generate a new certificate

Hopefully that site stays up.

Identifying mysterious wireless issues.

“The first drop was at 11, when lunch began.”

In my current position, I have been struggling to identify a particular wireless issue that was sporadically taking our wireless network down. At the moment, we have put APs our throughout the building, but only three people in one office are

Code Dump: channeldown.sh

Building on youtube.sh, this downloads an entire youtube channel. Usefull for marathon viewing sessions.

#!/bin/bash if [ "x$1" = "x" ] then echo channeldown "(username)" exit fi if [ ! "x$2" = "x" ] then MAX=$2 else MAX=100 fi USER=$1 i=1 while [ $i -lt "$MAX" ] do wget http://gdata.
Code Dump: youtube.sh

Downloads youtube videos using youtube-dl. I built it to download multiple videos in a row. Put each url in a pair of single quotes.

#!/bin/bash SETDIR="/downloads/watch/misc" DIRFLAG=0 for ARG in $* do ARG="$(echo "$ARG" | sed 's/feature=[a-z_+]*&//')" # http://www.youtube.com/watch?
Code Dump: Brighty

For some reason, on my Acer Aspire laptop, Ubuntu doesn’t seem to respond to the brightness settings, but this script works. It’s probably not terribly safe, but it add a good 20-30 minutes of battery life when I set it to the lowest setting I can see.

#!/bin/
Code Dump: rand.sh

Generates random strings. I got tired of having to go to random.org, and this takes like 2 seconds.

VERSION=3  
NUM=0  
LEN=0  
MODE=0  
ALLOW=""  
for Y in $@  
do  
        if [ $Y = "-n" ]
        then
                MODE=1
                ALLOW=$ALLOW"0-9"
        elif [ $Y = "-s" ]
        then
                MODE=5
                ALLOW=$ALLOW'!@#$%^&
Code Dump: Core.sh and Startconky.sh

Used to randomly select from several wallpapers and apply a specific conky theme to it.

core.sh

#!/bin/sh TOTAL=$(ls /home/michael/.conky/ | grep png | wc -l) if [ "x$1" != "x" ] then if [ $1 -gt -1 ] && [ $1 -lt $(ls /home/michael/.conky/| grep png | wc -l) ] then
Rsyslog - Log only to first match.

Giving the tilde (~) as an action causes that message to be discarded. There’s also the ampersand syntax – if a line starts with & it is considered an additional action for the previous line’s selector. So something like this:

mail.* /var/log/mail.log
& ~

kern.* /var/log/kern.