2021-11-02

Windows CMD file to grab those cute little wallpaper pictures from windows so you can decide if you want to keep a copy

The CMD file requires the creation of sub-folders c:\tmp\pics  (or change it below to someplace else).  I use a temporary folder because the command will copy some silly icon tiles for the Start Menu  that you won't want and will  never change.  I start Windows Exporer on the specific folder and I SORT IT BE LARGEST to smallest because the smaller files under 150 kilobytes will be those miscellaneous files.  The largest ones are the beautiful wallpaper pictures.


 @echo off
c:
cd \
mkdir tmp
cd tmp
mkdir pics
cd c:\tmp\pics
echo y | del *.*
copy C:\users\kevin\appdata\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets c:\tmp\pics
ren * *.jpg
explorer.exe c:\tmp\pics

2021-11-01

Host a wireless access point on Linux from the command line




This script with it's two related configuration files worked on Raspberry Pi Raspbian Linux. What was always sketchy was the "driver=" line in the hostapd.conf. I was disappointed that it could only host 802.11g or 802.11n. I even messed around with USB-attached WiFi to host, but the Raspberry Pi 3's always were limited for power no matter how high-end of a power connection I provided. I had many more problems with Fedora but this was approximately Fedora 29 vintage or so. This script continues to fascinate me, but I no longer have the energy to beat my head against the wall until it works. I once ran a Fedora desktop for an emergency bridge (not with this script) but the WiFi was always a problem to the other building, due to the poor access point in the other building.


$ cat /local/etc/hostap
#!/bin/bash
killall -9 hostapd
#/usr/sbin/ifconfig wlan1 10.121.11.1 netmask 255.255.255.0 up
/usr/sbin/ifconfig wlan1 10.121.11.1 netmask 255.255.255.0 up
/usr/bin/killall -9 /usr/sbin/hostapd
/usr/sbin/hostapd -t -B /etc/hostapd/hostapd.conf

/usr/bin/killall -9 dhcpd
/usr/sbin/dhcpd wlan1


/usr/sbin/iptables -L -t nat | /bin/grep MASQUERADE ||
{
/sbin/sysctl -w net.ipv4.ip_forward=1
/sbin/sysctl -w net.ipv6.conf.all.forwarding=1
$ipt -t nat -F
$ipt -F
$ipt --table nat --append POSTROUTING -s 10.121.11.0/24 -j MASQUERADE
}




$ cat /etc/hostapd/hostapd.conf
interface=wlan0
#driver=rtl871xdrv
#driver=nl80211
hw_mode=g
#hw_mode=n
#driver=nl80211
ssid=TEST-WiFi-NAME
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=WIFI-PASSWORD-GOES-HERE
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_ptk_rekey=600
macaddr_acl=0





$ cat /etc/dhcpd.conf

shared-network iphonenet {
subnet 10.123.213.0 netmask 255.255.255.0 {
range 10.123.213.10 10.123.213.50;
option broadcast-address 10.123.213.255;
option routers 10.123.213.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name-servers 8.8.8.8, 4.2.2.2, 8.8.4.4;
}
}
</preformatted>




Changing a filesystem UUID to upgrade an Android MicroSD without changing app

On a MicroSD to be replaced by an upgrade/new MicroSD, you plug it into the chip drive, without mounting the filesystem (you can but it isn't necessary), then run "blkid" to find the UUID of the old MicroSD.


On Linux if you connect a MicroUSB, you can run a "mkdosfs" (make DOS filesystem) to format the filesystem with the same UUID of the previous MicroSD.


mkdosfs -i 12345678 /dev/sdh1
**** no dash in the UUID above
or
tune2fs /dev/sdX1 -U 1234-5678

Subnetting/subnet table in text only - my own creation

Network subnet

subnet 128
Binary 1000 0000 25bits
Bits 1 9 17 25
0-127
128-255


subnet 192
Binary 1100 0000 26bits
Bits 2 10 18 26
0-63
64-127
128-191
192-255


subnet 224
Binary 1110 0000 27bits
Bits 3 11 19 27
0-31
32-63
64-95
96-127
128-159
160-191
192-223
224-255


subnet 240
Binary 1111 0000 28bits
Bits 4 12 20 28
0-15
16-31
32-47
48-63
64-79
80-95
96-111
112-127
128-143
144-159
160-175
176-191
192-207
208-223
224-239
240-255


subnet 248
Binary 1111 1000 29bits
Bits 5 13 21 29
0-7
8-15
16-23
24-31
32-39
40-47
48-55
56-63
64-71
72-79
80-87
88-95
96-103
104-111
112-119
120-127
128-135
136-143
144-151
152-159
160-167
168-175
176-183
184-191
192-199
200-207
208-215
216-223
224-231
232-239
240-247
248-255


subnet 252
Binary 1111 1100 30bits
Bits 6 14 22 30
0-3
4-7
8-11
12-15
16-19
20-23
24-27
28-31
32-35
36-39
40-43
44-47
48-51
52-55
56-59
60-63
64-67
68-71
72-75
76-79
80-83
84-87
88-91
92-95
96-99
100-103
104-107
108-111
112-115
116-119
120-123
124-127
128-131
132-135
136-139
140-143
144-147
148-151
152-155
156-159
160-163
164-167
168-171
172-175
176-179
180-183
184-187
188-191
192-195
196-199
200-203
204-207
208-211
212-215
216-219
220-223
224-227
228-231
232-235
236-239
240-243
244-247
252-255


subnet 254
Binary 1111 1110
Bits 7 15 23 (NO CLASS D)👈
0-1
2-3
4-5
EVEN-ODD

Windows-R to command line to control panels - I hate mouse-clicking all the time



I like to type command lines to start control panels. I never memorized them all.
Windows-R and then type "ncpa.cpl" to control your network adapters.



Accessibility Options control access.cpl XP

Action Center control /name Microsoft.ActionCenter 8, 7

control wscui.cpl 8, 7

Add Features to Windows 8 control /name Microsoft.WindowsAnytimeUpgrade 8

Add Hardware control /name Microsoft.AddHardware Vista

control hdwwiz.cpl XP

Add or Remove Programs control appwiz.cpl XP

Administrative Tools control /name Microsoft.AdministrativeTools 8, 7, Vista

control admintools 8, 7, Vista, XP

Automatic Updates control wuaucpl.cpl XP

AutoPlay control /name Microsoft.AutoPlay 8, 7, Vista

Backup and Restore Center control /name Microsoft.BackupAndRestoreCenter Vista

Backup and Restore control /name Microsoft.BackupAndRestore 7

Biometric Devices control /name Microsoft.BiometricDevices 8, 7

BitLocker Drive Encryption control /name Microsoft.BitLockerDriveEncryption 8, 7, Vista

Bluetooth Devices control bthprops.cpl13 8, 7, Vista

control /name Microsoft.BluetoothDevices Vista

Color Management control /name Microsoft.ColorManagement 8, 7, Vista

Color1 WinColor.exe2 XP

Credential Manager control /name Microsoft.CredentialManager 8, 7

Client Service for NetWare control nwc.cpl XP

Date and Time control /name Microsoft.DateAndTime 8, 7, Vista

control timedate.cpl 8, 7, Vista

control date/time 8, 7, Vista, XP

Default Location control /name Microsoft.DefaultLocation 7

Default Programs control /name Microsoft.DefaultPrograms 8, 7, Vista

Desktop Gadgets control /name Microsoft.DesktopGadgets 7

Device Manager control /name Microsoft.DeviceManager 8, 7, Vista

control hdwwiz.cpl 8, 7, Vista

devmgmt.msc 8, 7, Vista, XP3

Devices and Printers control /name Microsoft.DevicesAndPrinters 8, 7

control printers 8, 7

Display control /name Microsoft.Display 8, 7

control desk.cpl XP

control desktop XP

Ease of Access Center control /name Microsoft.EaseOfAccessCenter 8, 7, Vista

control access.cpl 8, 7, Vista

Family Safety control /name Microsoft.ParentalControls 8

File History control /name Microsoft.FileHistory 8

Flash Player Settings Manager control flashplayercplapp.cpl 8

Folder Options control /name Microsoft.FolderOptions 8, 7, Vista

control folders 8, 7, Vista, XP

Fonts control /name Microsoft.Fonts 8, 7, Vista

control fonts 8, 7, Vista, XP

Game Controllers control /name Microsoft.GameControllers 8, 7, Vista

control joy.cpl 8, 7, Vista, XP

Get Programs control /name Microsoft.GetPrograms 8, 7, Vista

Getting Started control /name Microsoft.GettingStarted 7

Home Group control /name Microsoft.HomeGroup 8, 7

Indexing Options control /name Microsoft.IndexingOptions 8, 7, Vista

rundll32.exe shell32.dll,Control_RunDLL srchadmin.dll 8, 7, Vista, XP

Infrared control /name Microsoft.Infrared 8, 7

control irprops.cpl 8, 7, Vista

control /name Microsoft.InfraredOptions Vista

Internet Options control /name Microsoft.InternetOptions 8, 7, Vista

control inetcpl.cpl 8, 7, Vista, XP

iSCSI Initiator control /name Microsoft.iSCSIInitiator 8, 7, Vista

Keyboard control /name Microsoft.Keyboard 8, 7, Vista

control keyboard 8, 7, Vista, XP

Language control /name Microsoft.Language 8

Location and Other Sensors control /name Microsoft.LocationAndOtherSensors 7

Location Settings control /name Microsoft.LocationSettings 8

Mail4 control mlcfg32.cpl5 8, 7, Vista, XP

Mouse control /name Microsoft.Mouse 8, 7, Vista

control main.cpl 8, 7, Vista

control mouse 8, 7, Vista, XP

Network and Sharing Center control /name Microsoft.NetworkAndSharingCenter 8, 7, Vista

Network Connections control ncpa.cpl 8, 7, Vista

control netconnections 8, 7, Vista, XP

Network Setup Wizard control netsetup.cpl 8, 7, Vista, XP

Notification Area Icons control /name Microsoft.NotificationAreaIcons 8, 7

ODBC Data Source Administrator control odbccp32.cpl XP6

Offline Files control /name Microsoft.OfflineFiles 8, 7, Vista

Parental Controls control /name Microsoft.ParentalControls 7, Vista

Pen and Input Devices control /name Microsoft.PenAndInputDevices Vista

control tabletpc.cpl Vista

Pen and Touch control /name Microsoft.PenAndTouch 8, 7

control tabletpc.cpl 8, 7

People Near Me control /name Microsoft.PeopleNearMe 7, Vista

control collab.cpl 7, Vista

Performance Information and Tools control /name Microsoft.PerformanceInformationAndTools 8, 7, Vista

Personalization control /name Microsoft.Personalization 8, 7, Vista

control desktop 8, 7, Vista

Phone and Modem Options control /name Microsoft.PhoneAndModemOptions Vista

control telephon.cpl Vista, XP

Phone and Modem control /name Microsoft.PhoneAndModem 8, 7

control telephon.cpl 8, 7

Power Options control /name Microsoft.PowerOptions 8, 7, Vista

control powercfg.cpl 8, 7, Vista, XP

Printers and Faxes control printers XP

Printers control /name Microsoft.Printers Vista

control printers Vista

Problem Reports and Solutions control /name Microsoft.ProblemReportsAndSolutions Vista

Programs and Features control /name Microsoft.ProgramsAndFeatures 8, 7, Vista

control appwiz.cpl 8, 7, Vista

Recovery control /name Microsoft.Recovery 8, 7

Region control /name Microsoft.RegionAndLanguage 8

control intl.cpl 8

control international 8

Region and Language control /name Microsoft.RegionAndLanguage 7

control intl.cpl 7

control international 7

Regional and Language Options control /name Microsoft.RegionalAndLanguageOptions Vista

control intl.cpl Vista

control international Vista, XP

RemoteApp and Desktop Connections control /name Microsoft.RemoteAppAndDesktopConnections 8, 7

Scanners and Cameras control /name Microsoft.ScannersAndCameras 8, 7, Vista

control sticpl.cpl XP

Scheduled Tasks control schedtasks XP7

Screen Resolution control desk.cpl 8, 7

Security Center control /name Microsoft.SecurityCenter Vista

control wscui.cpl XP

Software Explorers8 msascui.exe9 XP

Sound control /name Microsoft.Sound 8, 7

control /name Microsoft.AudioDevicesAndSoundThemes Vista

control mmsys.cpl 8, 7, Vista

Sounds and Audio Devices control mmsys.cpl XP

Speech Recognition Options control /name Microsoft.SpeechRecognitionOptions Vista

Speech Recognition control /name Microsoft.SpeechRecognition 8, 7

Speech control sapi.cpl10 XP

Storage Spaces control /name Microsoft.StorageSpaces 8

Sync Center control /name Microsoft.SyncCenter 8, 7, Vista

System control /name Microsoft.System 8, 7, Vista

control sysdm.cpl XP

System Properties control sysdm.cpl 8, 7, Vista

Tablet PC Settings control /name Microsoft.TabletPCSettings 8, 7, Vista

Task Scheduler7 control schedtasks 8, 7, Vista

Taskbar control /name Microsoft.Taskbar 8

rundll32.exe shell32.dll,Options_RunDLL 1 8

Taskbar and Start Menu control /name Microsoft.TaskbarAndStartMenu 7, Vista

rundll32.exe shell32.dll,Options_RunDLL 1 7, Vista, XP

Text to Speech control /name Microsoft.TextToSpeech 8, 7, Vista

Troubleshooting control /name Microsoft.Troubleshooting 8, 7

User Accounts control /name Microsoft.UserAccounts 8, 7, Vista

control userpasswords 8, 7, Vista, XP

Welcome Center control /name Microsoft.WelcomeCenter Vista

Windows 7 File Recovery control /name Microsoft.BackupAndRestore 8

Windows Anytime Upgrade control /name Microsoft.WindowsAnytimeUpgrade 7, Vista

Windows CardSpace control /name Microsoft.CardSpace 7, Vista

control infocardcpl.cpl 7, Vista

Windows Defender control /name Microsoft.WindowsDefender 8, 7, Vista11

Windows Firewall control /name Microsoft.WindowsFirewall 8, 7, Vista

control firewall.cpl 8, 7, Vista, XP

Windows Marketplace control /name Microsoft.GetProgramsOnline Vista

Windows Mobility Center control /name Microsoft.MobilityCenter 8, 7, Vista

Windows Sidebar Properties control /name Microsoft.WindowsSidebarProperties Vista

Windows SideShow control /name Microsoft.WindowsSideShow 8,7, Vista

Windows Update control /name Microsoft.WindowsUpdate 8, 7, Vista12

Wireless Link control irprops.cpl

Linux - editing the HOSTS file - archive when starting changes

Four simple lines of bash/sh script to archive the /etc/hosts file before changing it. Don't leave home without this tiny gold nugget script.

#!/usr/bin/bash
xdate=`date +%Y%m%d%H%M`
cp /etc/hosts /etc/hosts.$xdate
vi /etc/hosts
scp /etc/hosts 10.10.10.43:/etc
# last line copies the new file to another Linux








Editing the HOSTS file in Windows

The Windows Hosts file  is 

c:\windows\system32\drivers\etc\hosts

It seems to be locate here all the way through Windows 11.  Why I don't know.  Use BlueLife Hosts Editor, because it can archive your hosts file and mark it read-only after editing it.  THIS IS A GOOD IDEA as some malware will install malicious entries like:

127.0.0.1 google.com www.google.com

----- Send google website to nowhere


 https://www.sordum.org/8266/bluelifehosts-editor-v1-3/

Windows acting as a router between two interfaces

This is a registry merge, and it is WAY stale.  It's many years ago that I researched this, and memory serves, this works.  Passing traffic THROUGH a Windows server(regular windows too?) between two network interfaces, perhaps wired to wireless, even if the wireless is USB-attached.


==================
 Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"IPEnableRouter"=dword:00000001

Windows - scheduling a program on the command line

I felt compelled to write this during a migration from CMD to schedule the restoration of a service after the migration was completed. Pardon the Windows commentary which can be easily changed.


schtasks /Create /SC once /TR "net.exe start sshd" /ST 18:00  /TN STUPID-WINDOWS

LFTP - to mirror file systems - bidirectional - delete optional

I had this working just the other day.  It was a research-only script, because it relies on the security-sketchy "ftp" service.  Nevertheless, very cool. 

Flag Linux FTP file system mirroring 

#!/usr/bin/bash
HOST="10.10.11.17"
USER="backup"
PASS="PASSWORD"
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/lv1/pictures"
RCD="/lv2/pictures"
#DELETE="--delete"
lftp -c "set ftp:list-options -a;
open '$FTPURL';
lcd $LCD;
cd $RCD;
# reverse means upload
 mirror -c \
       $DELETE \
       --verbose \
       --exclude-glob a-dir-to-exclude/ \
       --exclude-glob a-file-to-exclude \
       --exclude-glob a-file-group-to-exclude* \
       --exclude-glob other-files-to-exclude"
lftp -c "set ftp:list-options -a;
open '$FTPURL';
lcd $LCD;
cd $RCD;
# reverse means upload
 mirror -c --reverse \
       $DELETE \
       --verbose \
       --exclude-glob a-dir-to-exclude/ \
       --exclude-glob a-file-to-exclude \
       --exclude-glob a-file-group-to-exclude* \
       --exclude-glob other-files-to-exclude"

Suffering VNC in Fedora 34 and up

Four scripts to setup and launch vnc in Fedora 34 Linux and up (may become stale information).  I favor KDE, so I am not a GNOME worshiper. 

$ cat vnc1setup
systemctl enable --now vncserver@:1.service
echo :1=root >>  /etc/tigervnc/vncserver.users
echo session=plasmax11 >> /root/.vnc/config
echo securitytypes=vncauth,tlsvnc >> /root/.vnc/config
echo geometry=1000x850 >> /root/.vnc/config


$ cat vnc1start
systemctl start vncserver@:1.service

$ cat vnc1stop
systemctl stop vncserver@:1.service


$ cat vnc1restart
systemctl restart vncserver@:1.service

Two simple commands in Linux to install the illusive and very useful "VTOP"

 dnf install -y nodejs
 npm install -g vtop








Generic Linux RSYNC script to manage all the crazy options

I use this for my own backups at home.

The command line arguments are source and destination and these may or may not include one SSH access filesystem.   Include "--delete" to delete changes from the destination that are no longer in the source.

If named "rs":
rs /etc backup@10.10.10.33:/lv1/backup

DO NOT include the source directory (for example above "etc') in the destination address.  It doesn't work right if you do.  Do ask, hours of suffering rsync, knowing it was better than graphical options.

#!/usr/bin/bash
#  named "rs"
IFS=$(echo -en "\n\b")
echo -------------------------
echo -----STARTING------------
echo ---------- $* ---------------
datestart=`/usr/bin/date`
echo $datestart
echo -------------------------
echo -------------------------
/usr/bin/rsync --progress --protect-args -rvv --update --whole-file $* | /usr/bin/egrep -v "uptodate|\/$|newer"
echo -------------------------
echo -------FINISHED----------
echo ---------- $* ---------------
echo started $datestart
/usr/bin/date
echo -------------------------
echo -------------------------



Matrox Monarch 5-minute video recordings assembled for Youtube.

This is a short bash scirpt I used to compose 5-minute mov files into one mpg file to upload to Youtube. We have a Matrox Monarch that rec...