Useful Stuff

Here are some files and other stuff that I have found useful over the years.


Watching the Ubuntu syslog

In Ubuntu, you can display the last 10 lines of the syslog in the terminal by using the tail command, and if you leave it open, any new lines will show up there as well. This is super useful for watching your .NET Core application running on Linux and trying to figure out what is going wrong. Here is the command:

tail -f /var/log/syslog

Find all non-MP3 files in a folder (Windows 10)

Let’s say for the sake of argument you have a folder with some MP3 files in it, and you want to see if there are any non-MP3 music files in there, or any other random stuff. I just realized you can go into that folder in Windows 10 File Explorer, and in the search box in the upper right corner of the window, enter this for your search text:

*.* kind:-mp3 -type:"file folder"

Dictionary to JSON in the Xcode debugger

If you are stopped at a break point while developing an iOS application in Objective-C, and you have an NSDictionary or NSMutableDictionary that you want to turn into JSON text, you can enter this command into the debugger, where you would substitute your dictionary for ‘theDictionary’ below:

po [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:theDictionary options:1 error:nil] encoding:4]

Hide icons on MacOS desktop

To hide all of the icons from the desktop of your MacOS machine, open the Terminal application and enter this command:

defaults write com.apple.finder CreateDesktop false; killall Finder

Then, once you are done with your screen capture or recording, you can use this command to restore icons back:

defaults write com.apple.finder CreateDesktop true; killall Finder

Finding files by name on a Mac

If you want to find all the files on your Mac that match a particular file name or pattern with wildcards, go into Terminal and enter the following command:

sudo find ./ -name "filename*.ext"

The sudo may require an administrative password, but will likely keep you from seeing a bunch of “Permission denied” errors.


Finding files by contained text on a Mac

If you want to find all the files on your Mac that contain a particular text string, go into Terminal and enter one of the following commands:

grep -r 'TextToFind' .
grep -r 'TextToFind' . --include=*.txt

The first one will recursively search all files starting at the current directory, and the second one will only search the files with a .txt file extension. Also, please keep in mind that the text search is case sensitive.


Removing .svn folders on a Mac

After you open up the Terminal and change to the root directory where the .svn folders start, enter the following command:

find ./ -name ".svn" | xargs rm -Rf

Windows 7 batch file command

enquire.com batch file command — I used this for the longest time in on my 32-bit Windows dev boxes to collect key presses inside of my batch files. Unfortunately, this application does not work on my Windows 7 Ultimate 64-bit OS, so I have to modify all of my batch files to use the choice command instead.


Animated GIFs

daffy_swinging

bugs_and_daffy

black_lab

Leave a Reply