Skip to content

Instantly share code, notes, and snippets.

View thcipriani's full-sized avatar

Tyler Cipriani thcipriani

View GitHub Profile
@thcipriani
thcipriani / shufflin.rb
Created June 12, 2012 18:15
Playlist Shuffle kinda in kinda ruby
songs1 = shuffle(allChannel1Songs)
songs2 = shuffle(allChannel2Songs)
songs3 = shuffle(allChannel3Songs)
channel_1_percent = channel1_percent/100
channel_2_percent = channel2_percent/100
channel_3_percent = channel3_percent/100
songsRequired = 500
playlist = []
<?php
require_once 'lib/AmazonECS.class.php';
$track = $_GET['track'];
$access_key_id = 'YOUR ACCESS KEY ID';
$secret_access_key = 'YOUR SECRET ACCESS KEY';
$affiliate_id = 'YOUR AFFILIATE ID';
$client = new AmazonECS($access_key_id, $secret_access_key, 'com', $affiliate_id);
$response = $client->category('DigitalMusic')->responseGroup('Images')->search($track);
@thcipriani
thcipriani / convert powerpoint.pdf powerpoint%d.jpg
Created November 29, 2012 21:20
ImageMagick 6.7.9-3, gs 8.7.0
[root@aspen ~]# convert powerpoint.pdf powerpoint%d.jpg
convert: no decode delegate for this image format `/tmp/magick-f6DSZRDI-00000001' @ error/constitute.c/ReadImage/544.
convert: Postscript delegate failed `powerpoint.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/679.
convert: no images defined `powerpoint%d.jpg' @ error/convert.c/ConvertImageCommand/3044.
@thcipriani
thcipriani / .bashrc
Last active December 10, 2015 07:18
Bash prompt to show svn branch name and whether you have local mods (beyond a single switch)
function parse_svn_dirty {
if [[ ($(svn st 2> /dev/null) == "") || ($(svn st 2> /dev/null | wc -l) == 1 && $(svn st 2> /dev/null | sed -e 's/\s*\(.\)\s*.*/\1/') == 'S') ]]; then
echo -e '\033[0;32m✔'
else
echo -e '\033[0;31m✗✗✗'
fi
}
function parse_svn_branch {
svn info 2> /dev/null | grep -i url | sed -e "s#url: $REPO\(.*\)#$(echo -e '\033[1;37m'). $(echo -e '\033[00m')svn at $(echo -e '\033[1;37m')\1$(parse_svn_dirty)#i"
Vagrant::Config.run do |config|
config.vm.box = "upsync_vagrant_base"
config.vm.forward_port 80, 8080
config.vm.share_folder("scripts", "/usr/local/bin/upsync", "/usr/local/bin/upsync")
config.vm.share_folder("publichtml", "/var/www/html/sandboxes/upsync", "./upsync", :owner => 'apache', :group => 'apache')
config.vm.share_folder("sapublichtml", "/var/www/html/sandboxes/sa2", "./sa2", :owner => 'apache', :group => 'apache')
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/graph", "1"]
config.vm.network :hostonly, "33.33.33.10"
end
mysql> delete from events_copy; delete from events_details_copy; | mysql> select * from events_details_copy where id = 1;
Query OK, 1644841 rows affected (31.62 sec) | +----+----------+-----------------+-------+
| | id | event_id | detail | value |
| +----+----------+-----------------+-------+
| | 1 | 1 | original_log_id | 99243 |
| +----+----------+-----------------+-------+
<?php
$arr = array(1, 2, 3);
/**
* PHP Weirdness 1
* 'continue' acts like 'break' inside of a switch statement when inside of a loop
* whereas 'continue' acts as expected inside an elseif block
*/
foreach ($arr as $item) {
switch($item) {
@thcipriani
thcipriani / gist:4969584
Last active December 13, 2015 20:28
configure
./configure \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.082352941176470587</real>
<key>Green Component</key>
<real>0.082352941176470587</real>
@thcipriani
thcipriani / gist:6309434
Created August 22, 2013 16:19
Get stream metadata from icecast
curl "GET" -H "Icy-Metadata: 1" http://[streamurl] > ~/Desktop/[outputfile]
tail +16000c ~/Desktop/[outputfile] | head | sed "s/StreamTitle='\(.*\)';.*/\1~/" | perl -i.bak -pe 's/[^[:ascii:]]//g' | cut -d '~' -f 1 | head -n 1