A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Windows command prompt get set environment variables
Yuck. I feel dirty writing about the Windows command line, but sometimes you just need to get a job done.
View all environment variables
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
View a specific environment variable, e.g. PATH
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH
Set an env var locally (not persistent)
set FOO="foo"
Set an env var globally (persistent) - must be run as administrator
setx BAR "bar" /M
View individual local env vars
echo %FOO%
echo %BAR%
Type GBP symbol without numeric keypad
Full size keyboard numpad method
If you have a numeric keypad to the right of you keyboard, you can type Alt+0163 to get a UK pound sterling symbol on a US-keyboard.
Modern laptop numpad method
Some laptops use a Fn (function) key and overlay the numpad on the main keyboard - so on a Dell Latitude I can hold Alt+Fn and type MJOL (which corresponds to 0163) to get a £ symbol.
...but some modern laptops don't have a numeric keypad at all. For those situations, see below.
Keyboard language switch
Install a UK keyboard alongside the US keyboard in control panel, and then type Win+Space to switch between them. Probably Windows 10 only.
Shift-3 usually types a # (hashtag) when set to US keyboard, and a £ (pound sterling) when set to UK keyboard.
Windows 10 character map (May 2019 update)
Type Win+. (dot) and you'll get a character map with all the symbols you'll ever need! 😊
It even remembers the ones you've used recently for quick access. (❁´◡`❁)
For faster keyboard navigation you can press [Tab] to cycle through the controls and [Enter] to select.
Old Windows method
Open the character map application from the start menu. You can search for it in the latest Windows, or it may be hidden in the Accessories folder for older versions.
Batch deleting files in Windows
dir /s *.jpg /b > jpgs.txt
Why not to use a pop-up window
It's akin to using nested tables for display, fer chrissakes!
Reasons why it's wrong:
- It's a poor user experience because the user doesn't get any of the usual browser functionality in the pop-up window, like the back button or the icon that tells you the page is loading.
- I'm sure I'll think of some more later
Windows: folder or file open in another program
"The action can't be completed because the folder or a file in it is open in another program"
This stunningly unhelpful error message has persisted through many versions of Windows.
The way I work around it is:
- Rename an unrelated file or folder nearby, then rename it back again.
- The original folder or file should now be "unlocked"
Linux window managers
Gnome 2 was good, Gnome 3 was where it all went wrong, but now people are switching back to Gnome 3.
See also evilwm (joke) or xfce (supposed to be fast).
When Ubuntu's window manager went bad (11.04 -> 11.10)
(source)
Prevent Windows from restarting after an update
All non-Home users can apply the same policy change by adding a new key to the registry. Go to Start > Run/Search for regedit. Navigate to HKEY_LOCAL_MACHINE SOFTWARE Policies Microsoft Windows WindowsUpdate AU. Create a new 32-bit DWORD value named NoAutoRebootWithLoggedOnUsers and give it a value of 1.
(source)
How to transfer files between Windows 7 and Android 4
Then go to Developer Options (read elsewhere how to get this), and tick 'USB debugging'.
Voila - your device will appear in My Computer | Portable Devices.
Copy the files to a subdirectory of the Android Camera device in Windows, and move them into the right place from within Android. e.g. using ES File Explorer
Outlook 2007 reminder windows always on top
Simple way
Private Sub Application_Reminder(ByVal Item As Object)
If TypeOf Item Is AppointmentItem Then
MsgBox "Message text", vbSystemModal, "Message title"
End If
End Sub
(source)
Sophisticated way
Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const FLAGS As Long = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1
Private Sub Application_Reminder(ByVal Item As Object)
Dim ReminderWindowHWnd As Variant
On Error Resume Next
ReminderWindowHWnd = FindWindowA(vbNullString, "1 Reminder")
SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
End Sub
(source)
How to forward your SSH key
1. Run pageant, put it in startup, and pass it your key
2. Run putty or MobaXterm, configure them both to do "ssh -A" (i.e. forward your key)
3. On the server, check your SSH key is loaded:
ssh-add -l
4. ssh -A to other servers
Linux:
ssh -A to each server
Your PC does not need dynamic wallpaper or a health check
- Dynamic wallpaper/screensaver
- PC health check
- Speed up your PC
- Clean your PC
- Any new special anti-virus program (you should only have one trusted anti-virus program)
- Defrag your computer
Windows "add or remove programs" list is empty
If still no luck:
- Highlight and copy the entire bolded text below:
- cmd /c REGEDIT /E "%userprofile%\desktop\uninstall.txt "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
- Click on Start > Run and paste in the text you have just copied. Hit Enter.
- A notepad document should appear on your desktop called uninstall or uninstall.txt
- Open it to view the contents
- Look for the "UninstallString" values and copy those into the Start > Run box to uninstall programs
Thanks to tomshardware.co.uk
How to manage problematic application windows in Ubuntu
To find out what application a window belongs to: Type xwininfo in the console, then click on the window.
To kill a window, type xkill in the console, then click on a window to kill it.
Macro recorders for Windows 7
- AutoHotKey - scripting only, but users have built a recorder too.
- Overall good. Free.
- Steep learning curve, but users on IRC channel are very helpful
- Note: Trying running program in "Administrator mode" if it doesn't seem to work.
- How to develop scripts:
- Use Recorder to get basic outline
- Use included Window Spy to get precise coords (set "CoordMode, Mouse, Screen")
- May need to fiddle with WinActivate parameters
- Put sections of functionality into subroutines and test them individually
- Use TrayTips as debug output
- Make sure you make the script Sleep for at least 300ms between each action
- Quick Macro - Couldn't get it to work. Shareware.
- Auto Macro Recorder - Couldn't get it to work, either. Shareware.
- PC Anywhere - Couldn't even download it.
How to change a shape type in Visio
Use the 'Shape | Substitute' command.