2014 Top Listens
Straight from my LastFM profile:
- Iron Chic 193
- Mac DeMarco 167
- Spoon 164
- The War on Drugs 157
- Yo La Tengo 147
- TV on the Radio 144
- Real Estate 140
- Guided by Voices 122
- San Fermin 112
- Nude Beach 111
- Tweedy 108
- My Morning Jacket 107
- Woods 106
- BOAT 102
- Painted Palms 102
- Radical Dads 101
- Ultimate Painting 99
- Ryan Adams 96
- Mr. Gnome 96
- Modest Mouse 93
- Beck 92
- Built to Spill 92
- Black Lips 91
- Arcade Fire 91
- Sleepy Sun 90
- Ásgeir 90
- Paws 86
- Courtney Barnett 86
- The Skygreen Leopards 84
- Tops 84
- Shy Boys 83
- King Tuff 81
- Late Bloomer 81
- Wye Oak 81
- Alvvays 81
- Diarrhea Planet 80
- Chet Faker 80
- Lee Bains III & The Glory Fires 80
- Morrissey 77
- Stephen Malkmus and the Jicks 77
- Interpol 73
- Temples 73
- Hooray For Earth 73
- The Sea and Cake 70
- Elliott Smith 68
- The Velvet Underground 67
- jj 67
- Turbo Fruits 66
- Christopher Owens 66
- The New Pornographers 65
Fix WordPress’ default attachment “link to” setting
I say fix since this is a mild annoyance of mine. Anywho, here’s the fix.
1. Direct your web browser to: http://MY_DOMAIN_NAME.TLD/wp-admin/options.php
2. Look for image_default_link_type
3. Fix it. Delete the contents of the corresponding field. If you want to change it, the available values are: “”, “file”, “post”.
Published on August 15, 2014World Clock
How to CHMOD web files properly
To change all the directories to 755 (-rwxr-xr-x):
find /path/to/web/dir -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r–r–):
find /path/to/web/dir -type f -exec chmod 644 {} \;
chmod 644 {} \; specifies the command that will be executed by find for each file. {} is replaced by the file path, and the semicolon denotes the end of the command (escaped, otherwise it would be interpreted by the shell instead of find).
or alternatively, you could do the following:
chmod -R a+rX ./*
The X (that is capital X, not small x!) is ignored for files (unless they are executable for someone already) but is used for directories.
Thanks for the answers once again Stack Overflow.
Published on January 15, 2014Millionaire Chicken
2013 Top Listens
Straight from my LastFM profile:
- Guards (244)
- Born Ruffians (204)
- Courtney Barnett (204)
- Ghost Wave (194)
- Shout Out Louds (170)
- Mikal Cronin (166)
- The National (164)
- Yo La Tengo (156)
- BOAT (147)
- Arcade Fire (142)
- Diarrhea Planet (142)
- Beach Fossils (141)
- Colleen Green (134)
- Frankie Rose (132)
- Phosphorescent (129)
- Palma Violets (117)
- Bored Nothing (113)
- Ducktails (111)
- Psychic Ills (110)
- IO Echo (108)
- Starfucker (105)
- Mazes (99)
- Portugal. The Man (97)
- Belle and Sebastian (96)
- Deer Tick (96)
- Parenthetical Girls (93)
- The Joy Formidable (91)
- Those Darlins (89)
- HAIM (88)
- The Little Ones (88)
- The Pack A.D. (88)
- Surfer Blood (88)
- Psychic Friend (87)
- Dead Gaze (86)
- Foxygen (84)
- Surf City (81)
- Bass Drum of Death (80)
- The Spinto Band (78)
- Gold Fields (78)
- Bent Shapes (77)
- Nude Beach (76)
- Shannon and the Clams (74)
- Austra (72)
- Brazos (71)
- Daughn Gibson (71)
- The Thermals (70)
- The Avett Brothers (70)
- Lightning Dust (70)
- Small Black (70)
- Crocodiles (69)
Sorry ‘cp’ I’m gonna be spending more time with ‘rsync’ now
So just updated my dev machine and was transferring files back to it via cp
which was taking a long time. I just wanted to know how far along the command had progressed via a percentage/progress bar/etc. so that I could get a cup of coffee, or make lunch – if it was gonna take a very long time. I know it’s possible to do this but not by using cp
alone.
So I found rsync
after a little bit of googling. The part that I really like about it is the --progress
option, which let’s you know via stdout how far along the command is.
Here is a basic example:
rsync --progress -a /path/to/source /path/to/destination
– This will copy a directory, show progress, and maintain ownership, permissions, modified via the -a
option (Archive).
or, over the network:
rsync -zP /path/to/source handle@domain.tld:/path/to/destination
– This will copy source over the network connection specified, use compression, show progress and allow for continuing interrupted transfers.
P.S. As a preemptive measure you could also run du -sh
on dirs before copying to get an idea of how big they actually are.
Don’t store anything you need in /tmp
I know better but thought I’d write it here so I don’t forget. Again. Darn.
Here’s a black hole.
Image credit: NASA
PHP and JS Email Obfuscator
I have been using some great email obfuscation code created by Ross Killen ,Tim Williams and Andrew Moulden. And like Andrew’s generator that allows for “link text”, I needed a PHP solution for sites I’m developing. So here’s my twist:
function munge($address,$link_text) { $address = strtolower($address); $coded = ""; $unmixedkey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@-_"; $inprogresskey = $unmixedkey; $mixedkey=""; $unshuffled = strlen($unmixedkey); for ($i = 1; $i <= strlen($unmixedkey); $i++) { // set i = 1 because i = 0 was throwing an offset error in PHP $ranpos = rand(0,$unshuffled-1); $nextchar = $inprogresskey{$ranpos}; $mixedkey .= $nextchar; $before = substr($inprogresskey,0,$ranpos); $after = substr($inprogresskey,$ranpos+1,$unshuffled-($ranpos+1)); $inprogresskey = $before.''.$after; $unshuffled -= 1; } $cipher = $mixedkey; $shift = strlen($address); $txt = "<script type=\"text/javascript\" language=\"javascript\">\n" . "<!-"."-\n" . "// Email obfuscator script 2.1 by Tim Williams, University of Arizona\n". "// Random encryption key feature by Andrew Moulden, Site Engineering Ltd\n". "// PHP version coded by Ross Killen, Celtic Productions Ltd\n". "// This code is freeware provided these six comment lines remain intact\n". "// A wizard to generate this code is at http://www.jottings.com/obfuscator/\n". "// The PHP code may be obtained from http://www.celticproductions.net/\n\n"; for ($j=0; $j<strlen($address); $j++) { if (strpos($cipher,$address{$j}) == -1 ) { $chr = $address{$j}; $coded .= $address{$j}; } else { $chr = (strpos($cipher,$address{$j}) + $shift) % strlen($cipher); $coded .= $cipher{$chr}; } } if($link_text): $link_text_block = "document.write(\"<a href='mailto:\"+link+\"'>" . $link_text . "</a>\")\n"; else: $link_text_block = "document.write(\"<a href='mailto:\"+link+\"'>\"+link+\"</a>\")\n"; endif; $txt .= "\ncoded = \"" . $coded . "\"\n" . " key = \"".$cipher."\"\n". " shift=coded.length\n". " link=\"\"\n". " for (i=0; i<coded.length; i++) {\n" . " if (key.indexOf(coded.charAt(i))==-1) {\n" . " ltr = coded.charAt(i)\n" . " link += (ltr)\n" . " }\n" . " else { \n". " ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length\n". " link += (key.charAt(ltr))\n". " }\n". " }\n". // Original link markup //"document.write(\"<a href='mailto:\"+link+\"'>\"+link+\"</a>\")\n" . // Link markup from above $link_text_block . "\n". "//-"."->\n" . "<" . "/script><noscript>Please turn on javascript to email me." . "<"."/noscript>"; return $txt; }Published on October 16, 2013
Force page template on child pages in WordPress
This is something that could come in handy. I’ve found a need for it in using the Nextgen Gallery plugin with the gallery page link setting enabled.
// Force page template on child pages $page_children = get_pages('child_of=13'); foreach($page_children as $child){ $current_page_template = get_post_meta($child->ID,'_wp_page_template',true); if($current_page_template != 'page-OTHER_PAGE_TEMPLATE.php') update_post_meta($child->ID,'_wp_page_template','page-PARENT_PAGE_TEMPLATE.php'); }Published on August 21, 2013