Ubuntu: How To Setup TFTPD With File Creation

/etc/default/tftpd-hpa

TFTP_OPTIONS="--secure --create"
# service tftpd-hpa restart
tftpd-hpa start/running, process 2479
# echo asdf > asdf.txt
# tftp tftpd_server_name
tftp> put asdf.txt
Sent 6 bytes in 0.0 seconds
tftp>
Posted in Linux | Leave a comment

Ubuntu: How To Fix “WARNING: The following packages cannot be authenticated!”

apt-get update
Posted in Everything Else | Leave a comment

Ubuntu Kickstart: How To Partition Drive Automatically

# Stuff auto-generated by system-config-kickstart
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel 

# Preseed Auto-Partition Options
preseed partman-lvm/device_remove_lvm boolean true
preseed partman/confirm_write_new_label boolean true
preseed partman/choose_partition select finish
preseed partman/confirm boolean true
Posted in Linux | Leave a comment

Ubuntu Server: How To Disable GDM and Start in Text Mode

cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="text"
GRUB_CMDLINE_LINUX=""
...

Then, run update-grub and reboot.

A diff with the alternative amd64 ISO grub file looks like this:

< GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
---
> GRUB_CMDLINE_LINUX_DEFAULT="text"
Posted in Linux | Leave a comment

WordPress: How To Add Buttons To Every Post

wp-content/themes/twentyten/functions.php

At the top of every post:

function twentyten_posted_on() {
  [print stuff here]
  printf( __( 'Posted on %2$s by %3$s', 'twentyten' ),
    'meta-prep meta-prep-author',
    ...
  );
  [print stuff here]
}

Or at the bottom of every post:

function twentyten_posted_in() {
  [print stuff here]
  // Retrieves tag list of current post, separated by commas.
  $tag_list = get_the_tag_list( '', ', ' );
  ...
  // Prints the string, replacing the placeholders.
  printf(
    $posted_in,
    get_the_category_list( ', ' ),
    $tag_list,
    get_permalink(),
    the_title_attribute( 'echo=0' )
  );
}
Posted in Open Source | Leave a comment

WordPress: Change Default Header Images

wp-content/themes/twentyten/functions.php
Line 135

register_default_headers( array(
  'berries' => array(
          'url' => '%s/images/headers/berries.jpg',
          'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
          /* translators: header image description */
          'description' => __( 'Berries', 'twentyten' )
  ),
  'cherryblossom' => array(
          'url' => '%s/images/headers/cherryblossoms.jpg',
          'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
          /* translators: header image description */
          'description' => __( 'Cherry Blossoms', 'twentyten' )
  ),
...
Posted in Linux, Open Source | Leave a comment

CakePHP Scaffolding: How To Increase Default Records Per Page

lib/Cake/Controller/Component/PaginatorComponent.php
Line 71

        public $settings = array(
                'page' => 1,
                'limit' => 20,
                'maxLimit' => 100,
                'paramType' => 'named'
        );
Posted in Linux, Open Source | Leave a comment

Windows 7: How To Disable Pop-up Thumbnails When Hovering Over Taskbar

Method 1:

You may try the following steps to disable the Taskbar thumbnail preview in Windows 7:

1. Click “Start” and type “gpedit.msc” and hit Enter
2. Navigate to User Configuration, Administrative Templates, and Start Menu and Taskbar in left pan of Group Policy Editor.
3. Locate “Turn off Taskbar Thumbnails” in right pan of Group policy editor and double click.
4. Select “Enabled” and click “Apply” and “OK”.

Method 2:

If the above method doesn’t help, you may try the below steps:

You can disable the taskbar thumbnail feature (sort of) in Windows 7 using a registry edit. This can be done by setting the taskbar thumbnail preview hover delay to a large value (say 10000 milliseconds or more), so that the preview is not immediately generated when you hover over a taskbar icon.

1. Click Start, type regedit.exe and press ENTER

2. Navigate to the following location:

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Advanced

3. Create a new DWORD (32-bit) value named ExtendedUIHoverTime

4. Double-click ExtendedUIHoverTime and click Decimal

5. To increase the hover delay to 5 seconds, type 5000 . Type 10000 for 10 seconds and so forth…

6. Exit the Registry Editor.

7. Restart your computer.

Source: Microsoft

Posted in Windows | Leave a comment

Linux: How To Fix VIM Colorscheme Failure

If your colors don’t come back in VIM after deleting or removing your swp files…

Remove this directory:

/home/your-username/.vim

Note: This is a last resort method (as Scott mentions below), when simply writing and quitting doesn’t work.

Posted in Linux | 1 Comment

Cisco: Disable Translating Domain Server Timeout

To stop these messages (and the timeout pause):

Translating "'"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address

Do this:

SW0(config)#no ip domain-lookup
SW0(config)#
SW0#
%SYS-5-CONFIG_I: Configured from console by console

SW0#ssdf
Translating "ssdf"
% Unknown command or computer name, or unable to find computer address
Posted in Cisco | Tagged , | Leave a comment

Apache: VirtualHost Redirect Using mod_rewrite

  RewriteEngine     On
  RewriteRule       ^(.*)$        https://www.your-domain.com$1
Posted in Linux | Leave a comment

Windows: Stop fwupdate.exe

Remove LG Tool Kit from Programs

Posted in Windows | Tagged | Leave a comment

Linux: How To Partition and Mount a Second Drive

If your Linux server is configured with two hard disks, and you want to partition your second drive, you must:

  • Partition the secondary hard disk.
  • Create a file system for the new partition.
  • Mount the partition to make it accessible.

These instructions are specific to servers setup after July 15, 2005,
for servers prior to this, the path in the following steps will need to
be modified slightly. The ‘df’ command will show you how the current
filesystem is mounted, normally /dev/hdc was used for the new
partition. For more advanced partitioning and mounting options, please
see the vendor provided documentation for your Operating System.

NOTE: This article assumes you are working with a new, un-formatted disk. If this procedure is followed on a disk that contains data, the data will be destroyed.

To Create a Hard Disk Partition

  1. Via SSH, log in to your dedicated server as ‘root.’
  2. Type the following, and then press Enter.
    /sbin/fdisk /dev/sdb
  3. Type n to create a new partition.
  4. For extended or Primary (1-4), type p.
  5. Accept the defaults for the partition size.
  6. Accept the default for the first cylinder.
  7. Accept the default for last cylinder.
  8. Type w and press Enter to write partition information.

To Create a File System

  1. Type the following, and then press Enter.
    /sbin/mkfs -t ext3 /dev/sdb1

    It takes a few minutes to create the new file system on your secondary hard drive.

To Mount the File System

  1. Type the following, and then press Enter.
    cd /sbin
  2. Type the following, and then press Enter.
    mkdir /mnt/disk2
  3. Type the following, and then press Enter.
    chmod 777 /mnt/disk2
  4. Type the following, and then press Enter.
    /bin/mount /dev/sdb1 /mnt/disk2
  5. To ensure that your dedicated server mounts the new file system
    after each reboot, you need to add the command to mount the new file
    system to /etc/fstab.
  6. We recommend a backup of /etc/fstab before the update:

    • Type the following where mm_dd_yyyy represents the date of the backup, and then press Enter.

    cp /etc/fstab /etc/fstab_mm_dd_yyyy

    • Type the following, and then press Enter.

    echo "/dev/sdb1 /mnt/disk2  ext3 defaults 0 0" >> /etc/fstab
  7. Type the following, and then press Enter.
    /dev/sdb1 /mnt/disk2 ext3 defaults 0 0

Source: GoDaddy

Posted in Everything Else | Leave a comment

Windows: How To Enable Ping Responses

How can I enable ping with Windows Firewall?

It is a requirement that CUDN-connected computers must support the ICMP Echo (ping) function. The Windows Firewall may not respond to such incoming echo requests. If you intend to use Windows Firewall on the CUDN you must enable ping.

Windows XP SP2 or SP3

1. Open the Control Panel (from the Start menu – choose Control Panel or Settings and then Control Panel).
2. Open Windows Firewall (click Network and Internet Connections then Windows Firewall or double-click Windows Firewall.
3. On the General tab of the Windows Firewall dialogue box, make sure that the On (recommended) radio button is selected.
[You do not need to use two firewalls. Doing so may lead to confusion. If you intend to use Windows Firewall but have another firewall installed (such as ZoneAlarm) you should uninstall it - preferably before installing Windows XP SP2. If you decide you prefer an alternative to the Windows Firewall you can always reinstall it later].
4. Click the Advanced tab.
5. In the ICMP box click the Settings… button.
6. Tick the Allow incoming echo request box.
7. Click on OK and then OK again.
8. Close the Control Panel.

Windows Vista

1. Click on the Vista Start circle
2. Type cmd into the search box (this starts up the command prompt)
3. At the command line type
netsh firewall set icmpsetting 8 enable
4. Press the return/enter key

Posted in Windows | Leave a comment

Apple: iPod Keeps Restarting or Rebooting

  • After it reboots, hold the Select and Play buttons at the same time for 10 seconds until it goes into disk mode.
  • Then, connect the iPod to your computer to sync it with iTunes.
  • Restore the iPod to factory settings.
Posted in Apple | Leave a comment

Perl: Error Handling Try Catch Using Eval

  eval {
    ...
  };
  if ($@) {
    errorHandler($@);
  }
Posted in Languages | Tagged , , , , | Leave a comment

Ubuntu: Auto Install From USB Key Using Kickstart

1.  Create a bootable USB key using an alternate version of any Ubuntu iso.

2. Edit syslinux/txt.cfg

label install-serv
  menu label ^Auto Install 11.04 Server
  menu default
  kernel /install/vmlinuz
  append noprompt cdrom-detect/try-usb=true persistent vga=788 \
  initrd=/install/initrd.gz quiet \
  ks=http://your.kickstart.domain.com/your-kickstart-file.cfg --
Posted in Linux | Tagged , | Leave a comment

Linux: Apache FancyIndexing

IndexOptions FancyIndexing FoldersFirst VersionSort HTMLTable \
NameWidth=* DescriptionWidth=* Charset=UTF-8
Posted in Everything Else | Leave a comment

fswebcam: Unable to load font ‘luxisr’: Could not find/open font

# apt-get install -y apt-file
# apt-file update
# apt-file search luxisr.ttf
ttf-xfree86-nonfree: /usr/share/fonts/truetype/ttf-xfree86-nonfree/luxisr.ttf
Posted in Linux | Tagged , , , , , , | Leave a comment

SVN: Send Emails With Every Commit

SVNROOT=/svn
cd $SVNROOT/hooks
cp post-commit.tmpl post-commit
chmod 755 post-commit
vim post-commit

Send Nicely Formatted Emails

post-commit:

REPOS="$1"
REV="$2"
SHARE="/usr/share/subversion"
$SHARE/hook-scripts/commit-email.pl "$REPOS" "$REV" -l /tmp/log --from svn you@email.com

Modify URLs in email to link to ViewVC pages

/usr/share/subversion/hook-scripts/commit-email.pl:

@@ -451,23 +451,24 @@
     push(@body, "Date: $date\n");
     push(@body, "New Revision: $rev\n");
     push(@body, "\n");
+    my $url = "https://your.domain.com/viewvc/svn/";
     if (@adds)
       {
         @adds = sort @adds;
         push(@body, "Added:\n");
-        push(@body, map { "   $_\n" } @adds);
+        push(@body, map { "   $url$_\n" } @adds);
       }
     if (@dels)
       {
         @dels = sort @dels;
         push(@body, "Removed:\n");
-        push(@body, map { "   $_\n" } @dels);
+        push(@body, map { "   $url$_\n" } @dels);
       }
     if (@mods)
       {
         @mods = sort @mods;
         push(@body, "Modified:\n");
-        push(@body, map { "   $_\n" } @mods);
+        push(@body, map { "   $url$_\n" } @mods);
       }
     push(@body, "Log:\n");
     push(@body, @log);
Posted in Linux | Tagged , | Leave a comment