Archive for the 'Utilities' Category

Issue with f.lux and screenshots on Windows 10

Thursday, October 22nd, 2020

Recently I was helping my daughter with some homework and it was going well. That is until I tried to take a screen shot. The screen shot came out with a red tint to everything I captured. It took me a while as I worked through if it was a Snipping Tool issue or a general screen shot issue. It was any screen shot which was even more frustrating. I searched the internet for answers and saw some issues with Lenovo laptops but I am on a HP Laptop so that was no help. I tried updating the drivers for my video cards and that was no help.

Finally I thought of what could be adjusting colors on my computer and remembered I had installed f.lux to help with my sleep patterns as it helps to make the color levels of your monitor change as the night time arrives. It turns out that f.lux was messing with the screen capture and disabling f.lux made my screen captures look correct.

Tags:

Windows 10 Screen Rotation

Thursday, March 5th, 2020

I was recently trying to read a large log file and I needed to rotate my screen to portrait mode in order to read more text. Sadly, I learned that the CTRL+ALT+<LEFT ARROW> and CTRL+ALT+<RIGHT ARROW> key combinations are not implemented by the Windows OS but with each graphic card manufacturer. And sadly many of the more recent drivers no longer support this functionality.

In order to rotate the screen you need to use the display settings.

Either : Right-Click the desktop and choose “Display Settings”

or

Start > Settings > System > Display

Next: Select the display you want to rotate and scroll down to “Display Orientation”

Choose the orientation depending on the rotation of your mount. The options are:

  • Landscape
  • Portrait
  • Landscape (flipped)
  • Portrait (flipped)

Sadly the quick switching of displays may be gone but at least the ability still exists.

Tags:

Useful Git Aliases

Thursday, March 9th, 2017

When you use git often, it is helpful to implement some aliases for frequent commands. Git has config options to allow for shortening commands or allowing you to use a simple command instead of a line of text that is difficult to remember.

Some simple shortcuts:
To make checkout shorter

git config --global alias.co checkout

This will allow you to just type:

git co

To make status shorter:

 
git config --global alias.st status

This will let you see the log with branch indicators and a graph of the branches:

git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"

This is similar to the mylog alias but is useful on a color terminal as it will highlight useful items in the comments:

git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit ==all"

The results will be the following lines in your .gitconfig file:

[alias]
        st = status
        co = checkout
        mylog = log --pretty=format:'%h %s [%an]' --graph
        lol = log --graph --decorate --pretty=oneline --abbrev-commit --all

Tags:

How to stop XfinityWifi from automatically connecting

Wednesday, October 21st, 2015

I take the train to the city every day and I have been seeing my connection suddenly switch to ‘xfinitywifi’. This was getting very frustrating as I didn’t want to be on a public wifi and it was switching off of my hotspot or home network. It was not in the list of managed networks either. I found out that Comcast was automatically registering your Hardware MAC address and it would try to connect anytime it was in range.

The following steps helped to remove my Hardware MAC address from there system.

Login to Xfinity.com

  1. Click “My Account”
  2. Sign in — You must have access to billing to do this —
  3. Click “My Services” tab
  4. Click on “Xfinity Internet” on the subtab under “My Services & Equipment.”
  5. Select the “Manage devices for hotspot access” option
  6. Manage or remove the devices from your account by clicking “remove” next to each one you want to disconnect.

Tags:

Windows GodMode folder

Monday, January 12th, 2015

I just found a way to create a settings folder in Windows 7. This God Mode folder can be created by:

1) Create a new Folder
2) Rename the folder to : GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Then the folder will change its icon and give you access to the settings for your computer in one place.

VI: Indent lines

Wednesday, March 12th, 2014

The other day I was editing some code and as usual I was in Vi. It was python code and I had refactored some code and needed to indent a section of code. I did not relish the idea of trying to make sure that all the indents were done on several dozen lines of code so I looked into how to indent the code in VI.

Here is the sequence that let me indent blocks easily.

I used <shift>-V to select the entire line.

Then I selected multiple lines by using the arrow keys or j or k depending on which direction you need to select.

Then you use the ‘>’ key to indent to the right and the ‘<‘ key to decrease the indent to the left.

Counting lines, words and characters with wc

Thursday, February 13th, 2014

There is a simple Linux utility for counting characters, lines and words in files called wc. This allows you to give a file as an argument or a stream and get the counts of the aforementioned items.

wc <filename>

or

cat <filename> | wc

The options that wc accepts

-c,–bytes print the byte counts
-m,–chars print the character counts
-l,–lines print the line counts
-L,–max-line-length print the length of the longest line
-w,–words print the word counts

The ouput with no arguments will be three numbers (words,lines,characters. Otherwise the the number will reflect the argument you have passed.

And if you pass multiple filenames the output displays counts for all files and totals.

 >wc -l HelloWorld.java sample.txt
    8 HelloWorld.java
   25 sample.txt
   33 total

Tags: ,

Awk: Using awk to Truncate fields

Monday, October 29th, 2012

Working with data feeds is sometimes frustrating when you have over 50 columns and are trying to find the field that is too long for your insert into your database system of choice. I have found processing the files with different Linux utilities useful and one that I regularly use it “awk”. I was trying to get the substring of all fields in a product feed the other day and used the following trick.

awk -F 't' '{for(i = 1;i<NF;i++) printf("%s,",substr($i,0,50));print;};

The for loop iterates over all the fields separated by a tab in each line and the prints out the field with a length of 50 characters or less. The extra print is for the newline at the end of each line.

Tags: ,

Screen: Send a Ctrl-A to a terminal

Wednesday, October 10th, 2012

When you are using the Linux tool screen, there are times
that I need to send a ctrl-a character. This is a special command key in
screen that drives most of the other commands. But I use the ctrl-a to go
to the beginning of some of my commands and in order for the terminal to
get a ctrl-a you need to use the following key sequence:

ctrl-a  a

So to explain, you need to hold ‘control’ or ‘ctrl’ key and the ‘a’ key together
and then release the ‘ctrl’ key and press ‘a’ key and it will send a ctrl-a to
the terminal.

Tags: ,

grep -e :searching multiple terms

Saturday, September 22nd, 2012

When you have to process log files, it can be very useful to highlight the terms you are seeking. One way to highlight a term is to use grep with the –color option. The drawback to using this method is that if you are chaining the grep command after another command then the last grep is all that would be highlighted.
I found that you could use the following to highlist all terms:

grep --color -e 'search|search2' 

So to break down the command line, first we have the grep command followed by the –color option which (if your terminal allows it) will highlight the search term within the screen results. This means that if you put this into a file, then the color highlighting will be lost. The ‘-e’ option states that the next argument is going to be a regular expression based argument.
The full syntax of regular expressions is beyond the scope of this article but basically is a pattern to match strings. The reason I am using a -e option is to support the ‘|’ option that allows me to search for more than one term. The reason that the pipe character is escaped is that otherwise it would be considered as a character to search for instead of a separator. This also will color either term within the output. So I am searching for search or search2 anywhere within the files that I pass in.