Skip to content

Instantly share code, notes, and snippets.

View magnetikonline's full-sized avatar
💡
I have an idea!

Peter Mescalchin magnetikonline

💡
I have an idea!
View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active August 29, 2015 14:05
XBMC update library paths.

XBMC update library paths

Taken from XBMC Wiki.

Video library

SQL

UPDATE art SET url = REPLACE(url,'nfs://192.168.0.2/','nfs://nas/');
UPDATE episode SET c18 = REPLACE(c18,'nfs://192.168.0.2/','nfs://nas/');
UPDATE movie SET c22 = REPLACE(c22,'nfs://192.168.0.2/','nfs://nas/');
@magnetikonline
magnetikonline / README.md
Last active August 29, 2015 14:05
AWS s3curl.pl example.

AWS s3curl.pl example usage

Perl wrapper script for curl from Amazon to GET/PUT items to/from S3 buckets, adding the required headers to the curl command line.

Download: http://aws.amazon.com/code/128

Listing a bucket

$ chmod u+x s3curl.pl
$ ./s3curl.pl \
	--id [AWS_KEY] \
@magnetikonline
magnetikonline / run.sh
Last active August 29, 2015 14:05
Testing jpegtran (libjpeg-turbo) vs. mozjpeg compression abilities on a set of source JPEGs.
#!/bin/bash
rm turbo/*
rm mozjpeg/*
cd orig/
echo libjpeg-turbo
find . -name "*.jpg" -exec jpegtran -optimize -copy none -outfile "{}.tmp" "{}" \; -exec mv "{}.tmp" "../turbo/{}" \;
echo Done
@magnetikonline
magnetikonline / README.md
Last active August 29, 2015 14:06
AWS summary of EC2 storage types.

AWS summary of EC2 storage types

For my own sanity, as I always seem to struggle with this.

Elastic block store (EBS)

  • Can be attached to any EC2 instance in the same availability zone.
  • Recommended for long term persistence.
  • Can attach multiple EBS volumes to a single EC2 instance.
  • Survives reboot, stop/start and terminate (but only if not the root EBS volume).

Instance storage (ephemeral)

@magnetikonline
magnetikonline / README.md
Created September 29, 2014 21:41
Extract unique HTTP request lines from access.log.

Extract unique HTTP request lines from access.log

$ cat access.log \
	| grep "] \"GET /wp-content/themes/" \
	| awk '{print $7}' \
	| sort -u
@magnetikonline
magnetikonline / addoneday.sh
Created October 8, 2014 09:37
Add one day to file modification time on a collection of files in bash.
#!/bin/bash
find . -type f -exec touch -r "{}" -d '+1 day' "{}" \;
@magnetikonline
magnetikonline / clone.sh
Created October 21, 2014 22:57
Git shallow clone repository and any sub-modules within.
#!/bin/bash
git clone --depth 1 \
-qb $BRANCH_NAME \
$REPOSITORY_URL $TARGET_CLONE_DIR
cd $TARGET_CLONE_DIR
git submodule update -q --init --depth 1
@magnetikonline
magnetikonline / script.sh
Last active August 29, 2015 14:21
Bash script to rename collection of JPG images with numeric index, ordered by date created.
#!/bin/bash
IFS=$'\n'
counter=1
for file in $(ls -1tr *.jpg); do
mv "$file" "$(printf "img_%04d.jpg" "$counter")"
counter=$(($counter + 1))
done

Keybase proof

I hereby claim:

  • I am magnetikonline on github.
  • I am magnetikonline (https://keybase.io/magnetikonline) on keybase.
  • I have a public key whose fingerprint is FA4A B218 5B57 20B2 A93C C1E4 9C83 B9FB 627C 44B8

To claim this, I am signing this object:

@magnetikonline
magnetikonline / gist:3753174
Last active October 10, 2015 21:28
Building PHP 5.4.3 from source under RHEL 5/6.
## Building PHP 5.4.3 under Red Hat Linux 5/6 for php CLI and php-fpm (FastCGI for Nginx/etc.)
## Adjust your included PHP modules to suit.
$ yum install libxml2-devel libcurl-devel libjpeg-devel libpng-devel libmcrypt-devel
- Note: package 'libcurl-devel' is named 'curl-devel' under RHEL 5
$ mkdir /php/compile/path
$ cd /php/compile/path
$ wget http://au2.php.net/get/php-5.4.3.tar.gz/from/au.php.net/mirror
$ tar xvf php-5.4.3.tar.gz