Escaping characters on the command line by Joseph Palumbo

While doing some housekeeping on my computer I ran into a situation where I wanted to delete all files that had a (1) in the name.

I started by listing all files that ended in .jpg

$ ls *.jpg
Screenshot 2019-10-07 13.50.50.jpg

I thought I could delete those files using basically the same syntax on the command line, but this is what I got when I tested it out.

Screenshot 2019-10-07 13.53.37.jpg

After Googling around I found this article on apple.stackexchange.com that helped me figure it out.

You can use the \ to escape characters on the command line, like this:

$ ls *\(1\).jpg
Screenshot 2019-10-07 13.56.02.jpg

Which lead to this solution:

Screenshot 2019-10-07 13.58.09.jpg

Simple Python Script To Search Wikipedia From The Command Line by Joseph Palumbo

If you’re like me, you don’t like to take your fingers off the keyboard. And if, like me, you’re a keyboard cowboy, you probably do a lot of work from the command line.

I’m always looking for ways to increase my productivity by adding more tools and functionality to my command line. So here’s a very simply python script using Selenium to search Wikipedia from CLI.

from selenium import webdriver
from sys import argv # Include file to upload
import sys

# unpacks the arguments passed on the command line
script = argv[0]

# joins multiple strings into one to create search_term
search_term = ' '.join(sys.argv[1:])

# test is variable is set
try:
    search_term
except NameError:
    print 'Please enter search term'
else: 
    browser = webdriver.Firefox()
    browser.get('https://www.wikipedia.org')
    browser.find_element_by_id('searchInput').send_keys(search_term)
    # content = driver.find_element_by_css_selector('p.content')
    browser.find_element_by_css_selector('button.pure-button').click()

Once you have this you need to crease a bash alias to be able to access it easily. I created the following:

alias wiki='python /Users/palumbo/code/tools/search_wikipedia.py'

Now anytime I want to look up something in Wikipedia, I just need to type wiki <search term> into my terminal and it brings up a new Firefox window with the wikipedia page for that term.

Finder Tags and Terminal by Joseph Palumbo

As I’m focusing on organizing and decluttering my digital life, I’ve started using the MacOS tag feature introduced back in Mavericks. It’s a powerful tool that can be used to create some simple, elegant, and scalable solution to folder and file organization.

The problem is that I use Terminal at least half the time to work with my folders and files and Apple does not provide an out-of-the-box solution for adding/removing tags from CLI. So say ‘hello’ to tag, a fantastic solution working with tags from MacOS Terminal.

Read More

An unrelenting approach to happiness by Joseph Palumbo

There are so many goals in life. And it might be said that each person’s set of goal is as unique as their fingerprint. But in talking to so many people about what they want to achieve in life, I’ve learned two very distinct things.

First, I’m surprised at how many don’t have “goals”, or at the very minimum have extremely passive goals or goals set in materialistic consumption (“I want [this]”).

Secondly, despite what most people say their goals are, with just a few questions you can boil it down to the fact that their goals are just paths to what they perceive will make them happy. Even if that means they only look happy in the eyes of others.

I am extremely goal driven. I’m ambitious. I’m addicted to the thrill of achievement, and the more difficult the path to achievement, the bigger the rush when I finally reach it.

But a few years ago I figured out, or at least had a strong suspicion, that all of my goals, which were mostly professional, was my attempt at being happy, or doing what I thought would make me happy.

I’m still goal driven, but the biggest difference is that my goal is simply to be happy.

Sounds simple and easy, right?

Well, it’s not. Happiness is such an elusive things and can shift quickly depending on the circumstances of ones life. What makes you happy on Monday, might not be what makes you happy on Wednesday.

But despite that, I believe there are a few fundamental aspects to happiness that are universal across cultures and circumstances.

First, and probably the most important, is to live for yourself.

In the age of keeping up with the proverbial joneses, and trying to maintain a prominence in social media, it is all too easy to focus on activities that make you look happy and content in the eyes of others, but rarely does that address what makes you happy.

One of my favorite, and most disturbing, episodes of The Twilight Zone is where a bank clerk survives a nuclear war by falling asleep in the bank vault. When he awakes to find that he is most likely the last man on earth, he goes about his favorite pastime - reading.

I think there is a lesson to be learned here. If you were the last person on earth, or maybe more realistically, you had no access to social media, what would be the one thing you would do for yourself.

This is a critically important question to answer when it comes to achieving true happiness in your life. If nobody else could see what you do, or judge what you do, what would you do?

And that is the second most important question you need to answer for yourself. What would you do?

I have a lot of interests and at any given time it can be difficult to determine what I want to do. This can lead to a kind of paralysis, where the options are too many and the criteria for success too unclear. So another activity on which I spend a lot of time is figuring out exactly what makes me happy.

Once again, no small feat. But I find that keeping a daily journal where I detail what I’ve been doing, how does it make me feel, and what I would like to be doing really helps me keep my priorities straight when it comes to happiness.