Category Archives: snippets

How to use a PS1 in Linux/MAC

Here are the PS1‘s I use for my daily driver.  Feel free to take them and change them up.

I use different colors, so one doesn’t accidentally login or run something as root (which is in red, users are yellow).

To use these, simply copy and paste them into either the root user; or regular user’s .bashrc.

Alternatively you can add them to /etc/profile to make them enforced system wide. 

For MAC, it is the same; however the PS1 is a little different. See below.

 

Root

 

User

Finally a good note app for devs

Open Source Note Taking

This app is nice as it can be local, one time synced, or just offline notes if you are in a secure area (what started my search).  I am on a network where I can’t get to any cloud services at all, especially ones where you can give out data.  I am however able to go out and do research.  Leaving me with a tone of notes, and nothing to store them in with any sort of sense.

Also, I have a lot of markdown, and code snippets, and that sort of thing.  So, like most I started keeping plain text files.  This was not cutting it though; as many of you know.  II would on occasion have a mixture of code types in the same note.  This seems to handle those for the most part.  Although it is similar to Atom, which is my favorite IDE/text editor in a GUI; it is much lighter and doesn’t always try to correct me into some language.

At the end of the day, its just a great note app; and the files underneath are up to you to encrypt/sync/etc.  The editor I am referring to is Boostnote.  I will give a link to GitHub, and link to their sites download page.  Please try it out and enjoy! I hope this helps out a nerd out there somewhere.

 

Thanks,
Matthew Curry

MattCurry.com

Handy One-Liners – Full Debian Update

This one is great for a “Full Update” on debian / ubuntu machines.

It calls the script without ever installing anything (assuming curl is installed).  Be sure to run as root, either with sudo or as root directly.

As you can see in the snippet; it uses a script that is remotely hosted (in a github gist).  This is great because you  can see exactly what it does by looking at the script.  It just calls system commands, so it can’t do anything malicious.  Just run sudo, then the above command and it will run the below script:

Another trick you can do with something like this, is copy it to  /usr/bin/fullupdate (as root of course), and ensure its executable “sudo chmod +x /usr/bin/fullupdate”.  Then you can call “sudo fullupdate”, from anywhere and use it when needed. Alternatively, you can use it on a cron to run on a schedule!  If you don’t want all the options, just download the script and change it for your liking.

 

Welcome to open source.

Don’t forget! Linux Learning Resources

This is kept under the Linux Learning Project and Learning Resources section of the site, and is updated occasionally with new links.  Feel free to suggest one by contacting me directly.


LEARNING RESOURCES

Help/Chat:

Resources:

A few BASH tips from an old Linux admin.

Everyone has seen these “Top 50 commands” blah blah blah….. #clickbait….

I am writing this just to make BASH a much more pleasant experience for people new and old to Linux.  It is also for any sysadmin that has simply not been introduced to some of them.

I could list tons of them, but that’s going to get a simple TL;DR for most people.  Then they will move on.  So I will list a few and lets let those digest.  Keep in mind all commands are in Linux, and may vary by distribution.

First BASH tips (Simple, but time savers):

  1.  Type ‘cd’ and you will go to your home directory for the user you are logged into.
    1. Similar to “cd” ~, however ~ can sometimes rely on the environment.
  2. To return to the previous directory you can type ” cd -“.
    1. This will return you to your previous location, not home.
  3. Type “tailf”, instead of “tail f” for the same results.
    1. Also, “tail -200” can be used instead of “tail -n 200”
  4. Use a custom “PS1” for root, and regular users.
    1. A “PS1” is the text in the login prompt. See Example to the right:
      1. Notice it is yellow
      2. Do the same but in red for root.
    2. Examples:
      1. Debian PS1 for a normal user (as seen to the right)
      2. Debian PS1 for a ROOT user.
        1. These will need to be added to the bottom of “.bashrc” in your home directory
        2. Keep in mind files starting with a . are hidden in Linux, but there.
          1. I also have MAC PS1’s public in my gists.

 

I think that is enough for today, I hope this helps make BASH your friend.

 

-M

Pre-Built Jasper Kits, Ready to go out of the box!

These kits will arrive and be ready to use the moment you power them up. They will be customized to the user, and an image will be provided so they can restore any time they like.

They will include the following:

  • RPI3 B+
  • 32GB Class 10 SD Card
  • US Robotics 9610 [USB Speaker/Mic]
  • Customized/Installed/Setup of Jasper by me personally
    • Install of Jasper and all dependencies
    • STT Setup
    • TTS Setup
  • Testing
    • Running overnight
    • With your settings if you wish
  • Copy of your personalized image for backup
    • In case you wish to restore to a “Known Good” state
  • Updates
    • Such as customized integrations and modules provided by me.
    • Updated Installer / Setup script COMING SOON.


If you are interested in one of these kits, feel free to contact me or start the process by purchasing one below:




Jasper Images Updated version 1.4 (aka Revision 4)

They are updating now; this includes a few fixes and features.

 

  • Jasper Tools Cron Installed (keeps them updated)
  • TTS Server Setup Out of the box!
  • STT Setup Out of the Box! (Just add key in profile.yml)
  • Jasper Start at Boot Cron Installed (allows for Jasper to start at boot)
  • Tested with several different variations of USB devices
    • USB Mic /Speaker Combinations
  • A ‘paired’ installer will be released soon!
    • This will allow the user to answer a few simple questions and have it running in seconds.

I apologize for the delays recently, I have had some personal issues come up.

Projects Page Added!

As requested, I have created a place for my projects on my site.  Please feel free to follow me as I work through them.  They are not projects that I am taking on professionally. They are completely for fun, and with no expectation or time limits.  That being said, I am a huge supporter of open source.

So in that spirit, I will be posting all functional code when I feel its ready to be used.  I am always open to ideas/suggestions.  Feel free to contact me via my Contacts page any time.

Quick Tip of the Day.

Not that I have them daily, but I might if I get a good response.

Have you ever tried logging into an SSH server, and get a weird error:

/.ssh/config: line 22: Bad configuration option: 342200202

This is a very simple issue but it can be a huge PITA if you can’t fix it quickly.  This is especially true for those of us that have to use an enormous amount of keys in our daily lives.  I know, I have a fairly simple config for SSH, but I still ran into this issue when I pasted a block of text in  ~/.ssh/config.  I opened the file with VI, and NANO. I was only able to get it to work when I removed the spaces before each line it complained about.  I then just put them back as normal, and saved.

It turns out, that copying from another place can have the spaces not interpreted properly. They are tabbed indentations actually.  Once manually removed they are replaced by a normal “space” in the code and it should work properly.  I hope this saves some time for some people.

 

Thanks,
Matthew D. Curry

 

TCPDUMP with Date for Wireshark

Just another handy snippet:

It will date the output, and also put it in a handy pcap for Wireshark.

tcpdump -i eth1 -s0 -v -w /tmp/capture_`date +%d_%m_%Y__%H_%I_%S`.pcap

*Note: Should work on all Linux distros (make sure to have the right network interface selected, Ex: eth1); it might have to be slightly modified for Mac. Windows can go DIAF.