User Tools

Site Tools


start

Introduction

My name is Jim Lynch. I used to have a consulting company in GA and had developed this site to support it. In the 2008 panic I lost all my customers and have never succeeded in getting any new ones so I've turned this site into a place that I keep a number of programming hints. I am an engineer by education but spent the most part of my career working in the computer industry providing primarily programming support and project management. I retired in 2005 and spend a lot of time working on programming projects related to Linux, small computers (Pi's and the like), micro controllers (Arduino's and clones) and micro computers (ESP8266, ESP32, etc).

I have a 3D printer which I use to build various bits like containers for some of my small computer projects. I design my prints using the open source CAD program, Openscad. It appeals to my engineering background better than the more artistic cad programs like Blender and Fusion3D.

I'm also an amateur radio operator. I don't operate as much as I used to but still keep a finger on the key so to speak.

Touchpad

Use

synclient TouchpadOff=1

To turn the bloody touchpad off on laptop.

If that doesn't work, here's a script that works on my Dell Inspirion 11 3000 Series running Linux Mint Mate 20.

#!/bin/bash
x=`xinput list | grep Synaptics|awk '{ $1=""; $2=""; $3="";$4="";$6="";$7="";$8=""; print}' | awk -F'=' '{$1="";print}' | xargs`

xinput set-prop ${x} 164 0 # '"Device Enabled"' 

xinput list will give you a list of devices you can control. In my case the Synaptics device is the one I wanted to disable. The command that I originally used was “xinput set-prop 12 “Device Enabled” 0” but I couldn't figure out how to script that so I used the xinput “list-props 12” to discover the equivalent numeric value.

Bind

Before using chroot from a live CD to fix a system, use:

 mount -o bind /proc /mnt/proc/
 mount -o bind /dev /mnt/dev/
 mount -o bind /sys /mnt/sys

Subversion (SVN) backup using svnadmin dump

This script is being run once a day to assure I have the most recent dump of the repositories on this system.

#!/bin/bash
# this script looks for svn repos in /home/svnadmin and tests to see if they have been modified 
# since the last dump.  If so it does another svn dump.  This script will be run once a day 
# just before an offsite backup is performed
REPO=/home/svnadmin/repoBackup
for dir in /home/svnadmin/*;do
    if [ -f $dir/format ];then
        echo $dir is a repo
        b=${dir##*/} # gets the base name
        i=$(find $dir -newer $REPO/$b.dump |wc -c|cut --delimiter=' ' -f 1)
        echo count is $i
        if [ $i \>  0  ] ;then
            echo dump away
            svnadmin dump $dir >$REPO/$b.dump
        fi
 
 
    fi
done

A backup script using rdiff-backup is run on another remote system daily.

#!/bin/bash
MACHINE=fdcga.com
APP=/usr/bin/rdiff-backup
#/usr/bin/rdiff-backup
DEST=/backup2/$MACHINE/ 
Directory=/home/
cat >/tmp/exclude$$ <<EOFa
**tmp
**deb
**rpm
**exe
EOFa
IP=$MACHINE
$APP --exclude-globbing-filelist /tmp/exclude$$  ${IP}::$Directory ${DEST}/
rm /tmp/exclude$$
#echo $APP --exclude-globbing-filelist /tmp/exclude$$  ${IP}::$Directory ${DEST}/
Directory=/etc/
DEST=/backup2/$MACHINE/etc/
$APP  ${IP}::$Directory ${DEST}/

VirtualBox Resize XP disk

Find your .vdi file. Mine was in a VirtualBox directory. I am running on a Linux Mint distro.

VBoxManage modifyhd /home/jim/VirtualBox\ VMs/WinXP/WinXP.vdi --resize 20480

I added the XP disk to an existing Ubuntu virtual machine I had defined earlier, but using the VirtualBox manager, selecting the Ubuntu virtual machine, Clicked on Settings/Storage and click on Controller:IDE right click and select “Add hard drive”. In the dialog box select “Choose existing …” In the file chooser window that pops up, double click on the WinXP folder. Then choose the WinXp…vdi file.

Once you've selected and added it to your Linux virtual machine list of partitions and clicked all the OKs boot the Linux virtual machine.

Login as usual and from a command line run “gparted” if it's not there install it. On Ubuntu or Debian and derivatives “sudo apt-get install gparted” will work fine.

Now resize the windows partition, save and exit.

Shutdown Linux, boot XP. Checkdisk will probably run. After it boots it'll probably ask you to reboot, go ahead and do so. When you come back up you will have more disk space.

Date.js

    var now=new Date();
    today=now.toString('MM/dd/yyyy HH:mm:ss');
    <script src="js/date.js"></script>

Date.js can be found at: https://github.com/datejs/Datejs

Sample

I used this prompt in bard: generate the mysql 8 table using the following schema: id int 11 autoindex;name varchar 64;dat datetime current_time_stamp;

And it generated the following:

CREATE TABLE `my_table` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(64) NOT NULL,
  `dat` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Use code with caution. Learn more
This table has three columns:
  • id: An integer column that is the primary key of the table. This column is automatically incremented by MySQL.
  • name: A string column that stores the name of the record. This column has a maximum length of 64 characters.
  • dat: A datetime column that stores the date and time when the record was created. This column is automatically set to the current timestamp when a new record is inserted.

I hope this helps! Let me know if you have any other questions.

start.txt · Last modified: 2023/08/12 13:07 by admin