Nerd Alert- grep for dashes

Setup: I often drop breadcrumbs for myself in programs that have lots of console output. Out of long habit, my breadcrumbs will look something like: –-->Warning: file xyz.txt not found, creating...

This is great and typically helps me quickly find what I’m looking for in a bunch of alphabet soup. When the output over long processes gets spooled into logs that might be thousands of lines long, sometimes I just want to grep specific log messages, ie., maybe just show me all of the breadcrumb messages- those with “--->” in the line.

Grep is the obvious tool to grep large text files, but specifically searching for dashes can be tough, because grep considers the dash a special character.

I love grep, but for me, constructing the regular expression can sometimes be a pain in the neck. The key to the quick way of doing this grep is to use the double dash.

The double dash signals the end of options processing. In the examples below, I’m using the -n option to print the line numbers of the lines found. With the — double dash operator, I can only have that option (and any other options) before the double dash.

Here’s two ways to look for my breadcrumbs, which in this case can be found by looking for the arrow: “--->“. The first method specifically looks for the entire arrow:

# Using example.log:
# this looks specifically for "--->", showing line numbers as well
grep -n -- ---\> example.log

I often reduce this to just look for the three dashes. The reason why is that if one forgets to escape the greater-than sign like “\>“, the target file can get overwritten. Go ahead and ask me how I know this is true and how many times I’ve rediscovered this fact. Because of that, I often just look for the 3 dashes like so:

# Using example.log
grep -n -- --- example.log

Looks funny, works really well.

Posted in Uncategorized | Leave a comment

Laser Project: computer riser

I have a stack of laptops I use for work. I typically rotate the one I need to the top of the stack, plug in cables for the monitor and keyboard.

The laptop stack sits on top of my regular computer. The PC case is turned sideways and vent holes are facing the top and bottom instead of the sides. I wanted to be able to help airflow to those panels.

1st Pass: I cut a set of acrylic risers to get the PC off the tabletop and allow some air to get pulled in from the bottom of the case:

2nd pass: I added another set of risers for the top to hold a platform that will allow me to set my laptop on top for that sweet dual monitor action. My platform has the logo from our Little Free Library.

3rd pass:

  • A larger platform with notches that lock the risers in place. The smaller platform would occasionally tip over the risers when I was shuffling laptops.
  • More ventilation holes.
  • A cable catch. I have a stack of laptops that I have to cycle through. Sometimes I would drop the HDMI cable when swapping and have to fish it back out from behind the desk.
Posted in lasers, Uncategorized | Leave a comment

Nerd Alert: the find and grep I love the most

find . -name "*.*" -exec grep -H "needle in a haystack" {} \;

This find the search pattern and outputs the file name and the line with found search pattern.

Posted in Uncategorized | Leave a comment

Laser Project: number plate

RiverHaven needs a number plate, as its street name and number have been updated.

Number plate

This one was made with two layers of acrylic, painted and glued.

number plate, first pass
backing peeled for super glue
adding the raised layer
Posted in lasers | Tagged | Leave a comment

Laser Sketches, 2023 week 6

Carboard Gears
Topo Chico Snorlax
Posted in lasers | Leave a comment

Laser: Monsters and Labels

A quick little exercise while getting familiar with Lightburn:

laser cuts, two layers
topo chico snorlax

Simple label prototype for the Leviathan House maker:

Leviathan House

There isn’t much color contrast in the cardboard and soap, but the cutouts might really pop when I have a bigger difference between the soap and the label. The cutouts themselves could probably be bigger as well.

Big shoutout to the Nautilus Pompilius font (found everywhere) and Stencilfy from Tiffany Tseng.

label prototype

Once I get closer to the real thing, I (probably) won’t use cereal boxes plucked from the recycle bin. Not bad for a one shot quick prototype.

label prototype
Posted in lasers, projects, Uncategorized | Leave a comment

Laser Project 01

I’m currently cutting scrap cardboard while I’m learning the basics of how my laser engraver operates. During our last freez-apocalypse, we had a pipe burst in the attic. The shutoff valve box at the street was full of frozen mud and I couldn’t dig the valve handle out. Fortunately, there is a cutoff inside the house, it just needed a little labeling for easy location in the future:

Water shutoff hang tag in action

Pretty simple construction here- two layers of cardboard. The letters were cut from white cardboard and attached to the tag with a few dabs of super glue.

Two layers of laser-cut cardboard
topo chico box recycling
Posted in lasers, projects | Leave a comment

Hallo-wings

Leviathan Hall had big plans for Halloween this year. As it turned out, we tabled most of those. Decorating was out this year, as the Hall was getting a new roof installed. It was no easy task, and with a crew of guys actively on the roof and ground, we decided to stay out of their way. We plan to be back next year.

Our theme that we are kicking to next year is “steampunk”. We got started with some props, but only 1 pair of wings actually made it out in the wild this year. I made the wings, Jennifer put together all the clothes and made the accessories. We’ll be back with more next year!

http://www.bturnip.com/weblog/wp-images/bturnip/family/20221031/PXL_20221031_230731231.MP.jpg
http://www.bturnip.com/weblog/wp-images/bturnip/family/20221031/PXL_20221031_231201334.MP.jpg

These wings light up- the effect in the dark was really good, but I didn’t take any pictures this year.

Posted in Uncategorized | Leave a comment

Sumbuck

Graydon turned us on to this album. [Sumbuck] has this blue vinyl and an mp3 album available at their store link. Leviathan Hall favorites from “Oh Sweet Cafe Racer” are “Tigersharks” and “Spin”.

Posted in Uncategorized | Leave a comment

Nerd Alert: Setting up pylint as a Build Tool in Geany

Setup: I’m using the Geany IDE on an Ubuntu system. For this tip, I am just focusing on Python3 files. I can already automagically execute my scripts without leaving the Geany IDE with “Build Execute“, which I is already set up to F5.

What I want: I want to be able to run a pylint scan on my files inside of Geany.

How to:

  • Install pylint using pip3
    • from the command line: pip3 install pylint
    • test the installation from the command line: python -m pylint sample1.py
  • Configure Geany to use pylint
    • In Geany, have the file type set to Python by having a .py file open in the editor or choosing the file type manually with the “Document ⇒ Set Filetype ...” menu
    • Choose “Build ⇒ Set Build Commands” Choose one of the Python Command buttons. In my case, the second button was empty. I selected it and entered the “Pylint” menu item label.
    • Update for Ubuntu 22.04. I had a typo in the original post. The actual command to add into the build tools is python3 -m pylint "%f" This is the same command that should have been tested above. Here the %f is added for Geany and indicates the current file.
    • Once doing this, I have Pylint show up under the Tools menu with a keyboard shortcut already assigned:
Posted in computers/programming, Uncategorized | Leave a comment