Batch file to delete all but latest two files

Uncategorized No Comments


@echo off
set folder=C:\test

pushd "%folder%"
for /f "skip=2 tokens=*" %%i in ('dir /a:-d-s /b /o:-d') do echo "%%i"
popd

*** Stolen from Major Geeks forum member GermanOne

pfSense – Captive Portal

Uncategorized 1 Comment

To have reusable vouchers:

Edit /etc/inc/captiveportal.inc and modify:


/* This user was already logged in so we disconnect the old one */
captiveportal_disconnect($cpentry,$radiusservers,13);
captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION");
unset($cpdb[$sid]);

with:


/* This user was already logged in so we disconnect the old one */
if (isset($config['captiveportal']['noconcurrentlogins']))  {
captiveportal_disconnect($cpentry,$radiusservers,13);
captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION");
unset($cpdb[$sid]);
}

To get smaller voucher codes:

Generate new private and public key pair (can be done on any computer.)


openssl genrsa 31 > key.private
openssl rsa -in key.private -pubout -out key.public

Paste key.private and key.public in Services > Captive Portal > Vouchers under Voucher Public Key and Voucher Private Key.

I also changed the Character Set to: “2345678abcdefhjkmnpqrstuvwxyz”

It then generated 7 character voucher codes.

Disable IPv6 from CLI

Uncategorized No Comments

This must be run from a Administrator Command Prompt.


REG.EXE ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
\Tcpip6\Parameters /v "DisabledComponents" /t REG_DWORD /d 0xffffffff

Windows XP Add New Hardware USB

Uncategorized No Comments

Recently ran into a problem where an XP Machine was always popping up asking to install drivers for every little thing including USB Mouse and USB Mass Storage Device which shouldn’t ever happen. To fix it where it automatically installs the driver and assigns a drive letter go to the Command Prompt and type each of the following:


regsvr32 Softpub.dll
regsvr32 Wintrust.dll
regsvr32 Initpki.dll
regsvr32 Dssenh.dll
regsvr32 Rsaenh.dll
regsvr32 Gpkcsp.dll
regsvr32 Sccbase.dll
regsvr32 Slbcsp.dll
regsvr32 Mssip32.dll
regsvr32 Cryptdlg.dll

Favorite Wallpapers for Ubuntu

Uncategorized No Comments

Here are two of my favorite wallpapers for Ubuntu. I like to go Distro themed when I work on computers by default.

karmic-rusty-2

Originally from Atkarus Designs.

Ubuntu 9.10 Wubi Install Grub2 Problems

Uncategorized No Comments

Apparently there are still some bugs to work out with Ubuntu 9.10 RC. If you install with Wubi and update grub2 automatically rewrites the MBR which disables bootup to Windows but Ubuntu keeps working. Here is a temporary solution.

We need to fix the MBR for Windows. Since Ubuntu is the only Operating System we can now boot we need a way to fix it from inside of Ubuntu. ms-sys is an older package that is no longer available in the repo’s because of copyrights.

Visit http://packages.debian.org/etch/i386/ms-sys/download and download the package. Firefox should automatically ask you to open with GDebi Package Installer. Click Install Package and type in your password.

Next open up a terminal. Applications > Accessories > Terminal.


sudo ms-sys -w /dev/sda
[sudo] password for craig:
DOS/Windows NT master b oot record successfully written to /dev/sda

for a shorter way….


cd /tmp && wget -c http://ftp.us.debian.org/debian/pool/main/m/ms-sys/ms-sys_2.1.0-1_i386.deb && sudo dpkg -i ms-sys_2.1.0-1_i386.deb && sudo ms-sys -w /dev/sda

All the above assumes you only have one hard drive in your system on /dev/sda. If you have more than one hard drive please check by using “sudo sfdisk -l”. You’ll be looking for something like:


Device       Boot Start End     #cyls   #blocks      Id  System
/dev/sdb1   *      0+   2549    2550-  20482843+  7  HPFS/NTFS

This tells us we have a NTFS partition on /dev/sda1 which is the first partition on /dev/sda. So we know that we need to use /dev/sda. Substitute for your own hard drive. That may be /dev/sdb or /dev/sdc. Of course if your using Wubi its probably safe to say /dev/sda.

Ubuntu Customization Script

Uncategorized No Comments

I’m in the process of upgrading all my computers to the latest Ubuntu 9.10 (Karmic Koala) and I really wanted a way to quickly customize my interface. I wrote this quick script that I plan on running immediately after installing.

This script downloads and sets the Shiki-Brave theme, Droid Fonts, puts the Computer and Home folders on the desktop, Installs the Restricted software such as Java and Flash, and updates the system.


#!/bin/bash

sudo apt-get update && sudo apt-get install shiki-brave-theme ttf-droid -y
gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme Shiki-Brave
gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme gnome-brave
gconftool-2 --type=string -s /desktop/gnome/interface/document_font_name Droid\ Sans\ 10
gconftool-2 --type=string -s /desktop/gnome/interface/font_name Droid\ Sans\ 10
gconftool-2 --type=string -s /desktop/gnome/interface/monospace_font_name Droid\ Sans\ Mono\ 10
gconftool-2 --type=string -s /apps/metacity/general/titlebar_font Droid\ Sans\ Bold\ 10
gconftool-2 --type=string -s /apps/nautilus/preferences/desktop_font Droid\ Sans\ 10
gconftool-2 --type=string -s /apps/metacity/general/theme Shiki-Colors-Metacity
gconftool-2 --type=bool -s /apps/nautilus/desktop/computer_icon_visible 1
gconftool-2 --type=bool -s /apps/nautilus/desktop/home_icon_visible 1
gconftool-2 --type=bool -s /apps/nautilus/preferences/enable_delete 1
sudo apt-get install ubuntu-restricted-extras -y
sudo apt-get upgrade -y

Here is a screenshot:
Ubuntu 9.10 Screenshot

Zero Write Hard Drive

Uncategorized No Comments

I have always used third party tools to zero write hard disks when I’m done using them or when some body requests it done. However, I have started using a external hard drive enclosure and I wanted to do it within my Ubuntu.


dd if=/dev/zero of=/dev/sdb

Since I only have a single hard drive the external drive became /dev/sdb. You can double check to make sure your wiping the right drive by using…


sfdisk -l

Reset Gnome Panels to Default

Uncategorized No Comments

Recently I’ve some problems with the panels in Gnome getting all messed up. It can be difficult to get everything back exactly where you want it. Easy solution is just do delete your config and let gnome rebuild it back to the defaults.

At the terminal type:


rm -r ~/.gconf/apps/panel

Backup IMAP Account

Uncategorized 1 Comment

All of my email accounts are IMAP accounts so I have my email anywhere I go. I always worry about making a mistake and losing all my emails. I found this great program that lets you backup your IMAP emails and folders.

http://www.broobles.com/imapsize

To schedule a backup:

imapsize -backup -account=test_account

« Previous Entries Next Entries »