Saturday, March 26, 2016

find files from a certain date range in linux

When you need to find a file from a specific range of dates, like a reciept that you know you saved but can't remember where.. You can use the find command along with some parameters to find files newer than a specific date, older or between two dates.

Bash one-liner to fix "Failed to fetch" error for chrome in ubuntu

See this page for details on how an why, but here's the error:

W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release:
    Unable to find expected entry 'main/binary-i386/Packages'
    in Release file (Wrong sources.list entry or malformed file)

And this will fix it in one shot:

sudo sed -i 's?deb http://dl.google.com/linux/chrome/deb/ stable main?deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main?g' /etc/apt/sources.list.d/google-chrome.list

Sunday, March 13, 2016

bash functions to view markdown documents

If you're writing markdown documents from vim or emacs, here's a couple handy ways to view them as rendered HTML.

Saturday, March 12, 2016

Kill an ssh connection from the server side

So you don't like Bob today or maybe you want to test a failed connection.. Whatever your reason you need to kill the ssh connections for his user on your server.

Friday, March 11, 2016

Reverse SSH Forward with special user

We will create a user on our machine that the remote machine can connect as and initiate a reverse port forward. For this example, we'll allow the remote machine to connect with the user name "ssh-limited" and forward port 62222 back to themselves.