Add user and password to NGINX copy

openssl passwd -apr1

Enter password you want twice when prompted, it will generate an apr1 encrypted password



vi /etc/nginx/htpasswd

service nginx restart


Comskip commercial skipping on plex

Plex doesn't seem to install comskip on linux by default. Although it says it uses it, it's not in the tarball so nothing actually happens. I guess it assumes you've figured it out on your own(?).

Install comskip:


apt-get install -y autoconf libtool git build-essential libargtable2-dev libavformat-dev libsdl1.2-dev

sudo su -

git clone git://

cd Comskip




make install

Auto-skip *should* work now if you set it up in the DVR settings, existing recordings won't have commercials skipped.

Manual commercial scans (i.e. go fix my existing recordings!):

cd to your recording

comskip --ini=/usr/lib/plexmediaserver/Resources/comskip.ini MyRecording.ts

and wait.

it makes the edl and txt files for Plex to skip commercials, but does not modify the original file in any way

Or, go hit your entire DVR directory recursively:

Read more ›

Make iTerm 2 highlight all errors all the time

This helps when you have to chase down stupid stuff all day, every day by highlighting the typical offenders:

Launch iTerm2
Go to iTerm2 - Preferences - Profiles - Advanced - Triggers - Edit
Click +

In the Regex, type:   (error|ERROR|Error)
Action: Highlight Text
Pick a color, Pick a background color that stand out for you
Check the Instant box
Close back out

I have:


Sorting out (and finding!) connection resets on Linux:

Sorting out connection resets:

tcpdump -nn -v 'tcp[tcpflags] & (tcp-rst) != 0'


tcpdump -ilo -nn -v 'tcp[tcpflags] & (tcp-rst) != 0'

-n is to stop resolving DNS names

-nn is to stop resolving DNS names AND port numbers to names

This is really useful when an app is logging connection resets, but not telling you what it is trying to connect to in the first place.

Converting a Scratch game to an Android app

  1. Go to: create an account
  2. (Make your game, I'll wait)
  3. Export to Android: Log into scratch, copy the project ID from the URL
  4. Go to:
  5. Put the project ID that you got above into the field provided.
  6. Click "Package Project"
  7. Copy the generated URL, keep it somewhere safe
  8. Go to (Set up account)
  9. Click "Create Now"
  10. Choose "Website" and paste in the generated URL for your project from the phosphorus site above.
  11. Name your app
  12. Choose/Upload an icon
  13. Add a description if you want, but to test, this is unnecessary
  14. Click Download on the right side, (preview may or may not work, don't worry if it won't preview)
  15. It will download a .apk file, this needs to get loaded onto your android device, Dropbox or Seafile are the easiest, USB transfers work too.
  16. Copy the .apk file into Seafile/Dropbox/USB
  17. Open Seafile/Dropbox on the android and find the .apk file
  18. Touch it to download it
  19. Touch install when prompted (You may need to enable "Install from unknown sources" and try again)
Open the game on Android and test
Note that since it is Android, and scratch has no idea that it will become a touch app, you have to use things like "Follow Mouse" and "Click" or "Right Click" in addition to regular collision detection.
Make the sprite follow the mouse/touch:

bash tip: collapse or parse a big text doc into individual sorted words from columns

Start with list.txt like:

server7858   server7858   server7858   server7858   server7861   server7860   server8310   server8310   server7863   server8311

server7859   server7859   server7859   server7859   server8781   server8676   server8677   server8677   server8679   server8782

Which has duplicates and long lines and crap. Run this:

rm list2.txt

rm list3.txt

for word in `cat list.txt`; do echo $word ; done |sort |uniq >> list2.txt

sed -ibak -e 's/ //g' list2.txt

cat list2.txt |sort|uniq > list3.txt

vi list3.txt

ta da!

if you need word counts and such, pipe it through wc before running uniq

more metadata, this one is hard to find:

















Microsoft Visual Code won't start on CentOS 7/KDE

sudo cp /usr/lib64/ /usr/share/code/

cd  /usr/share/code/

sudo sed -ibak -e 's/BIG-REQUESTS/_IG-REQUESTS/g'

Had the exact same problem with Atom and this worked for that too.

Bash case switches

if [[ ${TAG_VALUE}XXX == "XXX" ]]; then

echo "TAG_VALUE was blank, exiting!"



case ${TAG_VALUE} in


echo 'I am the first box'



echo 'I am the second box'



echo 'I am the third box'



echo 'I am the fourth box'



echo 'I am the fifth box'



echo 'I am another box higher than 5'



Reading tags from CLI or bash in ec2 instances

# To read the Name tag:


INSTANCE_ID="`./ec2-metadata -i | cut -f 2 -d " " `"

REGION="`././ec2-metadata -z | cut -f 2 -d " " `"


TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"


set |grep TAG_VALUE

TAG_VALUE='brad test box'

# To see ALL tags to see WTF: (use region from above)

aws ec2 describe-tags --region us-east-1 --output=text

# To read the Created-by custom tag:


INSTANCE_ID="`./ec2-metadata -i | cut -f 2 -d " " `"

REGION="`././ec2-metadata -z | cut -f 2 -d " " `"


TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"

set |grep TAG_VALUE


# To read the nifi-node-num custom tag:


echo "TAG_NAME is: " ${TAG_NAME}

INSTANCE_ID="`./ec2-metadata -i | cut -f 2 -d " " `"


REGION="`././ec2-metadata -z | cut -f 2 -d " " `"


echo "REGION is: " ${REGION}

TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"

echo "TAG_VALUE is: " ${TAG_VALUE}

# You need the EC2 Metadata binary for the above to work


chmod u+x ec2-metadata

./ec2-metadata --help

Retrieving EC2 Metadata from within an EC2 instance

## Retrieving EC2 Metadata


chmod u+x ec2-metadata

./ec2-metadata --help

Usage: ec2-metadata


--all                     Show all metadata information for this host (also default).

-a/--ami-id               The AMI ID used to launch this instance

-l/--ami-launch-index     The index of this instance in the reservation (per AMI).

-m/--ami-manifest-path    The manifest path of the AMI with which the instance was launched.

-n/--ancestor-ami-ids     The AMI IDs of any instances that were rebundled to create this AMI.

-b/--block-device-mapping Defines native device names to use when exposing virtual devices.

-i/--instance-id          The ID of this instance

-t/--instance-type        The type of instance to launch. For more information, see Instance Types.

-h/--local-hostname       The local hostname of the instance.

-o/--local-ipv4           Public IP address if launched with direct addressing; private IP address if launched with public addressing.

-k/--kernel-id            The ID of the kernel launched with this instance, if applicable.

-z/--availability-zone    The availability zone in which the instance launched. Same as placement

-c/--product-codes        Product codes associated with this instance.

-p/--public-hostname      The public hostname of the instance.

-v/--public-ipv4          NATted public IP Address

-u/--public-keys          Public keys. Only available if supplied at instance launch time

-r/--ramdisk-id           The ID of the RAM disk launched with this instance, if applicable.

-e/--reservation-id       ID of the reservation.

-s/--security-groups      Names of the security groups the instance is launched in. Only available if supplied at instance launch time

-d/--user-data            User-supplied data.Only available if supplied at instance launch time.