Andrew Lee

Freelance Developer/Designer/System Administrator

Menu Close

WordPress Tutoring in Nashville and Remote

I am now offering WordPress tutoring in the greater Nashville area or remotely via Skype. Visit the WordPress Tutoring page to learn more!

Running Browsersync with a Simple WordPress Theme

I’m working on another simple WordPress theme and Browsersync provides a great way to automatically refresh your browser whenever a change is made. Usually you would include a sync tool in the build tool of your choice (Gulp, Grunt, etc.) but this also works by itself. Open your Terminal, install Browsersync (npm install -g browser-sync), cd into your theme directory, and paste this line in for it to “watch” your theme folder.

browser-sync start --proxy "local.wordpress.dev" --files "*.*"

Note that you’ll need to update the proxy address with whatever your development address is. Since I’m using VVV in this case, mine is local.wordpress.dev.

grep SSH Login Attempts

I recently needed to review all SSH login attempts on a server running Ubuntu Server and used this one-liner to accomplish it. Piping grep into less just lets you stay on the keyboard instead of scrolling with the mouse.

grep sshd /var/log/auth.log | less

Daryl – A New Jekyll Theme

Daryl is a super simple Jekyll theme that recently hit it’s 1.0.0 release.

daryl-screenshot

It’s purpose is to be highly-readable, performant, and simple. A 404 page is included, feed.xml is used for RSS, and it includes an Archive/Post-list page template.

Daryl is open source and all code is available on GitHub.

tail over SSH

tail displays a log and updates it in realtime. This command tail‘s the log over SSH so that you can keep a log displayed in one window while doing more terminal work in another tab/window.

ssh -t username@10.0.0.1 "tail -f /var/log/system.log"

youtube-dl

youtube-dl (available for UNIX/Windows) is probably my most-often used Python script. Copy/paste a YouTube URL (or any other supported website URL) and youtube-dl downloads the video locally. Incredibly handy especially when you hate buffering and would rather download something to watch it later (including whole playlists!).

After you install it, you can specify your settings in its .conf file at ~/.config/youtube-dl/config. My settings are below:

-f bestvideo[ext=mp4]+bestaudio --no-playlist

The “bestvideo” flag downloads the source video at its best format (1080p usually or 4k if available) as well as downloading the “bestaudio” source available as well. The “–no-playlist” option downloads only the video if the video is in the middle of a playlist but will download an entire playlist if you give it the playlist’s root URL. You can completely customize your settings as well like lowering the video resolution so that videos don’t take as long to download.

Here’s the syntax to use when downloading:

youtube-dl "https://www.youtube.com/watch?v=NMbM-ERy2Lk"

nmap

This command scans to see if port 22 is open within a network range and saves the output to nmapscan.txt.

nmap -p 22 -oN nmapscan.txt 172.29.16.0/22

scp

This command copies a file from your machine over SSH to a remote machine. Quotation marks are included to escape the folder name that has a space in it. Add -rp if you need to copy a directory:

  • -r means recursive
  • -p preserves modification times, access times, and modes from the original file
scp -rp /path/to/file-or-directory/ username@%hostname%:"/path to/destination"

Dotfiles

My code-related goal for this weekend was to get my dotfiles symlink’d and uploaded to GitHub for version control. This article was excellent at helping me get it setup.

 

Sam Smith – Lay Me Down (Flume Remix)

© 2016 Andrew Lee. All rights reserved.

Theme by Anders Norén.