<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Do Know Evil &#8211; A Blog by Tyler Mulligan</title>
	<atom:link href="http://www.doknowevil.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.doknowevil.net</link>
	<description>Tips and Tricks About Computers, Web Development, Linux, the Internet and the Like</description>
	<lastBuildDate>Sun, 02 Mar 2014 01:41:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Decoding the Mind</title>
		<link>http://www.doknowevil.net/2014/03/02/decoding-human-mind-hacks/</link>
		<comments>http://www.doknowevil.net/2014/03/02/decoding-human-mind-hacks/#respond</comments>
		<pubDate>Sun, 02 Mar 2014 01:41:57 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Lifehack]]></category>
		<category><![CDATA[Organization]]></category>
		<category><![CDATA[peripherals]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cognitive science]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[tigers]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1081</guid>
		<description><![CDATA[Alex Faaborg gives insight into how the human mind processes information, presenting fascinating examples.]]></description>
				<content:encoded><![CDATA[<p><a href="https://twitter.com/faaborg">Alex Faaborg</a> gives insight into how the human mind processes information, presenting fascinating examples.</p>
<p><iframe width="640" height="360" src="//www.youtube.com/embed/z2exxj4COhU?rel=0" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2014/03/02/decoding-human-mind-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expanding your bash knowledge and .bashrc file with some sweet tips</title>
		<link>http://www.doknowevil.net/2013/12/25/expanding-your-bash-knowledge-and-bashrc-file-with-some-sweet-tips/</link>
		<comments>http://www.doknowevil.net/2013/12/25/expanding-your-bash-knowledge-and-bashrc-file-with-some-sweet-tips/#respond</comments>
		<pubDate>Wed, 25 Dec 2013 06:46:56 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1075</guid>
		<description><![CDATA[I always thought commandlinefu.com had a nice repository information related to bash and your .bashrc files. as you can see from my dotfiles I&#8217;ve used different functions. There is a lot to learn here and create a .bashrc tailored to your use. Personally, I like to put additions into my .bash_aliases file as you can see in [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I always thought <a title="Command Line Fu" href="http://www.commandlinefu.com/commands/browse" target="_blank">commandlinefu.com</a> had a nice repository information related to bash and your .bashrc files. as you can see from my <a title="dotfiles" href="https://github.com/z/dotfiles" target="_blank">dotfiles</a> I&#8217;ve used different functions. There is a lot to learn here and create a .bashrc tailored to your use. Personally, I like to put additions into my .bash_aliases file as you can see in my github.</p>
<p>Some great functions and bash usage there make the site well worth reading and incorporating into your bash usage. My dot files aren&#8217;t perfect but I know I&#8217;ll always be looking to improve them. If you&#8217;re in the same boat check out the list above and start getting into hosting your dotfiles on github.</p>
<p>For more information about dotfiles, check out <a title="dotfiles for *nix based systems" href="http://dotfiles.github.io/" target="_blank">github&#8217;s notes on dotfiles</a>. Very smart and convenient way to have access / maintain your dotfiles. It&#8217;s always going to be a strive for perfection but these community based resources help you get started.</p>
<p>If I were to migrate to zsh, that&#8217;s a different story but we&#8217;ll worry about that as it comes. Good lucky, happy hacking. Happy Holidays and a Merry Chirstmas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/12/25/expanding-your-bash-knowledge-and-bashrc-file-with-some-sweet-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I find most annoying about WordPress</title>
		<link>http://www.doknowevil.net/2013/10/24/what-i-find-most-annoying-about-wordpress/</link>
		<comments>http://www.doknowevil.net/2013/10/24/what-i-find-most-annoying-about-wordpress/#respond</comments>
		<pubDate>Thu, 24 Oct 2013 02:01:35 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1067</guid>
		<description><![CDATA[I like WordPress when you take all the features, the community, the plugins, themes and documentation (codex) into consideration. There has always been one thing that really bothers me (I have plenty more) and that&#8217;s how it databases some information. Creating a &#8220;database&#8221; inside a database is generally frowned upon. In this instance, WordPress uses [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I like WordPress when you take all the features, the community, the plugins, themes and documentation (codex) into consideration.</p>
<p>There has always been one thing that really bothers me (I have plenty more) and that&#8217;s how it databases some information. Creating a &#8220;database&#8221; inside a database is generally frowned upon. In this instance, WordPress uses PHP serialization, which allows you to save a PHP array in the database. The issue resides in replacing database references.</p>
<p>If you were to have:</p>
<pre rel="brush:php">string(38) "C:3:"obj":23:{s:15:"My private data";}",</pre>
<p>replacing strings without the exact number of characters could cause something to break (due to improper unserialization). There are a lot of blogs that say, &#8220;take your SQL file and &#8220;find/replace&#8221; &#8220;mysite.com&#8221; with &#8220;mylivesite.com&#8221; &#8212; this can break or disregard plugin settings you&#8217;ve worked so hard on. This is because of the difference in length. &#8220;15&#8221; = &#8220;My private data&#8221;</p>
<pre rel="brush:bash">$ echo -n "My private data" |wc -c
15</pre>
<p>Replacing the length of the string, doesn&#8217;t replace that integer count.</p>
<p>It&#8217;s pretty deep in the code and relied by a lot of functions in the wp-core. I don&#8217;t believe changing it would be an easy process. Knowing this, if you wanted to put a &#8220;database&#8221; inside a database, perhaps JSON is a better option.</p>
<p>There are premium and free (hacky) versions to proper unserialize, change and reserialize your data (nothing I can point you to at the moment. The awareness that this is a case is something you should consider however.</p>
<p>I&#8217;ll give more details and outline other shortcomings and work-arounds in the near future. Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/10/24/what-i-find-most-annoying-about-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wp-cli &#8211; A command line interface for WordPress</title>
		<link>http://www.doknowevil.net/2013/10/07/wp-cli-a-command-line-interface-for-wordpress/</link>
		<comments>http://www.doknowevil.net/2013/10/07/wp-cli-a-command-line-interface-for-wordpress/#respond</comments>
		<pubDate>Mon, 07 Oct 2013 18:55:04 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1060</guid>
		<description><![CDATA[I came across wp-cli, which is a Command Line Interface (CLI) to WordPress (WP). There is a lot of out of the box functionality, with a blossoming community putting together &#8220;recipes,&#8221; or cookbooks in an effort to reduce tedious tasks you might normally do through the GUI. Using the CLI, enables you to script, or [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I came across <a href="http://wp-cli.org/" title="A command line interface for WordPress" target="_blank">wp-cli</a>, which is a Command Line Interface (CLI) to WordPress (WP).</p>
<p>There is a lot of out of the box functionality, with a blossoming community putting together &#8220;recipes,&#8221; or cookbooks in an effort to reduce tedious tasks you might normally do through the GUI. Using the CLI, enables you to script, or automate processes. This is great for web developers, and system administrators, amongst others.</p>
<p>I think the project summarized their tool set well in the following quote:</p>
<blockquote><p>WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.</p></blockquote>
<p>Browsing through the commands can give a basic idea of what tasks might be better scripted. Certainly a time-saver if applied correctly.</p>
<p>The anatomy of a &#8220;command&#8221; is broken down on <a href="https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook">wp-cli github.com wiki</a> which also links to other projects they may spark interest or be of direct use.</p>
<p>I&#8217;ve got a few application ideas in the conceptualization phase myself. I hope to write back more in regards to this tool in the future.</p>
<p>Readers, have you any advice, favorite applications, or alternative implementations worth looking into?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/10/07/wp-cli-a-command-line-interface-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Having fun with sed, easter eggs, hidden in plain view</title>
		<link>http://www.doknowevil.net/2013/10/06/fun-with-sed-hidden-in-plain-view/</link>
		<comments>http://www.doknowevil.net/2013/10/06/fun-with-sed-hidden-in-plain-view/#comments</comments>
		<pubDate>Sun, 06 Oct 2013 20:51:43 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=441</guid>
		<description><![CDATA[Introduction I was fooling around, practicing my bash skills and encoded a little something when I was writing a set of helper scripts in bash for Nexuiz (now forked to Xonotic). At line 406 in my github repository for NDT you&#8217;ll see I&#8217;ve left a harmless easter egg. Acknowledged in the case switch at line [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I was fooling around, practicing my bash skills and encoded a little something when I was writing a set of helper scripts in <a href="">bash</a> for Nexuiz (now forked to <a href="http://xonotic.org" target="_blank">Xonotic</a>). At line 406 in my <a href="https://github.com/z/ndt/blob/master/ndt.sh" target="_blank">github repository for NDT</a> you&#8217;ll see I&#8217;ve left a harmless easter egg. Acknowledged in the case switch at line 683:</p>
<pre class="bursh:bash">--nothing_to_see_here|--moo) moo;;</pre>
<p>Paying homage to the <a href="http://www.eeggs.com/items/37085.html" target="_blank">&#8220;apt-get&#8221; &#8220;moo&#8221; command easter egg</a>, in some regards.</p>
<h2>Make the cow say moo</h2>
<p><a href="http://www.doknowevil.net/wp-content/uploads/2013/09/2013-09-27-172121_640x222_scrot.png"><img src="http://www.doknowevil.net/wp-content/uploads/2013/09/2013-09-27-172121_640x222_scrot.png" alt="2013-09-27-172121_640x222_scrot" width="640" height="222" class="alignnone size-full wp-image-1036" srcset="http://www.doknowevil.net/wp-content/uploads/2013/09/2013-09-27-172121_640x222_scrot-300x104.png 300w, http://www.doknowevil.net/wp-content/uploads/2013/09/2013-09-27-172121_640x222_scrot-624x216.png 624w, http://www.doknowevil.net/wp-content/uploads/2013/09/2013-09-27-172121_640x222_scrot.png 640w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<pre class="brush:bash">echo -e 'VAAAAAZBVmKKVCZVDDDDDZVVVVVVVVEVVVGAAGZVVVVVVVVVEVVHKKIEAAAAAAAZVVVVVVVVVVVVHAAIEVVVVVVVIEFEZVVVVVVVVVVVVVVVVJJDDDDwVJZVVVVVVVVVVVVVVVVJJVVVVVJJZ' | sed 's/A/_/g;s/B/</g;s/C/>/g;s/D/-/g;s/E/\\/g;s/F/\//;s/G/\^/g;s/H/(/g;s/I/)/g;s/J/|/g;s/K/o/g;s/V/ /g;s/Z/\n/g'</pre>
<p>I know encoded strings look scary but this is an echo, so you should know it can&#8217;t harm your computer. The is a &#8220;poor man&#8217;s encryption&#8221; at best. It&#8217;s obfuscating the original cow output and using sed pattern replacements to revert back to the ASCII art it once was.</p>
<h3>Further Breakdown</h3>
<p>An example within the massive sed string of replacements, is one targeting the character &#8220;Z&#8221; to replace with &#8220;newline escape character, \n.&#8221;</p>
<pre class="brush:bash">s/Z/\n/g</pre>
<p>I will blog more about sed in the future. It&#8217;s a wonderful tool available in most *nix systems. The name is derived from <b>s</b>tream <b>ed</b>itor, it&#8217;s taking a stream of output and editing before outputting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/10/06/fun-with-sed-hidden-in-plain-view/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using WordPress Language Files to Spice Up Copy or Add HTML</title>
		<link>http://www.doknowevil.net/2013/10/01/using-wordpress-language-files-to-spice-up-copy-or-add-html/</link>
		<comments>http://www.doknowevil.net/2013/10/01/using-wordpress-language-files-to-spice-up-copy-or-add-html/#respond</comments>
		<pubDate>Tue, 01 Oct 2013 13:37:14 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Application Management]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[The Internet]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=636</guid>
		<description><![CDATA[Introduction Editing the core files of WordPress is an obvious no-no for any competent developer. It will make upgrades more of a task than they need to be and it isn&#8217;t very portable. Using the WordPress plugin system is one way to overcome the issue of extending the core, but what about rewriting language on [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Editing the core files of <a href="http://wordpress.org" target="_blank">WordPress</a> is an obvious no-no for any competent developer.  It will make upgrades more of a task than they need to be and it isn&#8217;t very portable.  Using the <a href="http://codex.wordpress.org/Plugins">WordPress plugin system</a> is one way to overcome the issue of extending the core, but what about <b>rewriting language on the forgot password form</b> or <b>displaying more details in error messages</b>?  Using language files, we can overcome this and even inject our own HTML.</p>
<h2>WordPress Language Files</h2>
<p>To learn about the way language files work in WordPress, first I needed to <a href="http://codex.wordpress.org/Localizing_WordPress">get a briefing in localizing WordPress</a>.  Which basically consist of two generated files (.po and .mo) where po is plaintext and mo is a compiled (machine code) version of the plaintext that will run faster at runtime.  They work by hooking into functions defined by the English language (i.e. __(&#8220;Forgot Password&#8221;)), so no English po/mo files exist.</p>
<p>I had to learn how to <a href="http://codex.wordpress.org/User:Skippy/Creating_POT_Files">create POT files</a>.  So I grabbed a fresh copy of WordPress, ran in through poedit:</p>
<pre class="brush:bash">sudo apt-get install poedit</pre>
<p>Loosely following this excellent blog post, <a href="http://www.solostream.com/blog/tutorials/translate-wordpress-theme/">how-to translate a wordpress theme</a>.</p>
<h2>English WordPress 3.x Language Files (po/mo)</h2>
<p>WordPress uses &#8220;gettext&#8221; to handle translation as described in the &#8220;briefing&#8221; link above.</p>
<p>These concepts work at the plugin level too. If there are language folders with .pot files, you can generate your own .mo file and change copy. In some instances you may want to develop a patch or give in touch with the developer of a plugin to allow for more flexibility in customized language through the back-end which would store a string in the database rather than a language file but generally speaking, generating your own lang file isn&#8217;t a problem.</p>
<p>The caveat here is that when you upgrade the plugin, you may have to regenerate the language.</p>
<h3>Further Reading</h3>
<p>Learn more about <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers" target="_blank">i18n (internationalization) for WordPress</a>.</p>
<p>I meant to post this months ago and never finished up the article but the question come up again recently <a href="http://www.saltermitchell.com" target="_blank">at work</a>. Please let me know if you need clarification on anything by asking questions in the comments. You can also email me: z@xnz.me</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/10/01/using-wordpress-language-files-to-spice-up-copy-or-add-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/bin/rm: cannot execute [Argument list too long]</title>
		<link>http://www.doknowevil.net/2013/09/27/binrm-cannot-execute-argument-list-too-long/</link>
		<comments>http://www.doknowevil.net/2013/09/27/binrm-cannot-execute-argument-list-too-long/#comments</comments>
		<pubDate>Fri, 27 Sep 2013 22:24:04 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1021</guid>
		<description><![CDATA[The Basics If you&#8217;ve ever come across this error, you likely had too many files in your folder. Opening the folder in a GUI is futile. What do you do? One solution would be to remove &#8220;chunks&#8221; of files at a time. That&#8217;s silly though, we like too keep things simple, right? If this isn&#8217;t [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2>The Basics</h2>
<p>If you&#8217;ve ever come across this error, you likely had too many files in your folder. Opening the folder in a GUI is futile. What do you do? One solution would be to remove &#8220;chunks&#8221; of files at a time. That&#8217;s silly though, we like too keep things simple, right?</p>
<p>If this isn&#8217;t working:</p>
<pre class="brush:bash">rm -rf *.jpg</pre>
<p>And you&#8217;re getting the error:</p>
<pre class="brush:bash">/bin/rm: cannot execute [Argument list too long]</pre>
<p>Try using the &#8220;find&#8221; command with the &#8220;-exec&#8221; flag as such:</p>
<pre class="brush:bash">find -iname "*.jpg" -exec rm -rf {} \;</pre>
<p>Note (I use &#8220;-iname&#8221; instead of &#8220;-name&#8221; out of habit. &#8220;-iname&#8221; merely means &#8220;case-insensitive&#8221; but it could be considered superfluous if I know all the extensions are lowercase.</p>
<h3>More Tips</h3>
<p>In another terminal I was able to verify the files were being removed by using &#8220;ls&#8221; (list files) piped (|) to the &#8220;wc&#8221; (word count) with the &#8220;-l&#8221; (lines) flag.</p>
<pre class="brush:bash">ls |wc -l</pre>
<p>Feeling lasy? use &#8220;watch&#8221; to let the command repeat itself.</p>
<pre class="brush:bash">watch "ls |wc -l"</pre>
<p>The command, &#8220;find,&#8221; is an awesome tool, which I&#8217;ve mentioned in other <a href="http://www.doknowevil.net/tag/bash/" target="_blank">bash related posts</a> on <a href="http://www.doknowevil.net">my blog</a>.</p>
<pre class="brush:bash">man find</pre>
<p>Feel free to ask questions in the comments.</p>
<p>Mr. Bougo has added great information on the behavior of &#8220;find&#8221; and other commands in the comments below. Certainly worth reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/09/27/binrm-cannot-execute-argument-list-too-long/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating high quality thumbnails for PDFs in Linux using Imagemagick﻿﻿</title>
		<link>http://www.doknowevil.net/2013/03/12/creating-high-quality-thumbnails-for-pdfs-in-linux-using-imagemagick%ef%bb%bf%ef%bb%bf/</link>
		<comments>http://www.doknowevil.net/2013/03/12/creating-high-quality-thumbnails-for-pdfs-in-linux-using-imagemagick%ef%bb%bf%ef%bb%bf/#respond</comments>
		<pubDate>Tue, 12 Mar 2013 01:23:56 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[imagemagick]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=1006</guid>
		<description><![CDATA[If you&#8217;ve been googling for a solution to this, you might have found the quality of your pdf thumbnails images created using imagemagick is less than what you&#8217;ve desired. There is a simple but not exactly straightforward reason for this. Imagemagick uses ghostscript to generate these thumbnails from pdfs, unless you specify the density before [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;ve been googling for a solution to this, you might have found the quality of your pdf thumbnails images created using imagemagick is less than what you&#8217;ve desired. There is a simple but not exactly straightforward reason for this. Imagemagick uses ghostscript to generate these thumbnails from pdfs, unless you specify the density before the filename, you may end up with poor quality thumbnails. I&#8217;ve used my <a href="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-20131.pdf">resume</a> to demonstrate.</p>
<pre class="brush:bash"># Create [a low quality] thumbnail image for the first page from a pdf
f="tyler.mulligan-resume-winter-2013.pdf"; convert $f[0] -quality 100 -resize 960x +adjoin $f-%02d.png</pre>
<pre class="brush:bash"># Create [a high quality] thumbnail image for the first page from a pdf
f="tyler.mulligan-resume-winter-2013.pdf"; convert -density 300 $f[0] -quality 100 -resize 960x +adjoin $f-%02da.png</pre>
<p>The difference in these thumbnails is minor but enough to drive a graphic designer insane. The font kerning is off and the shapes rasterize imperfectly.</p>
<p>Low Quality</p>
<p><a href="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-001.png"><img class="alignnone size-large wp-image-1014" alt="tyler.mulligan-resume-winter-2013.pdf-00" src="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-001-790x1024.png" width="625" height="810" srcset="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-001-790x1024.png 790w, http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-001.png 960w" sizes="(max-width: 625px) 100vw, 625px" /></a></p>
<p>High Quality<a style="font-size: 1rem; color: #0f3647;" href="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-00a1.png"><img class="alignnone size-large wp-image-1015" alt="tyler.mulligan-resume-winter-2013.pdf-00a" src="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-00a1-790x1024.png" width="625" height="810" srcset="http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-00a1-790x1024.png 790w, http://www.doknowevil.net/wp-content/uploads/2013/03/tyler.mulligan-resume-winter-2013.pdf-00a1.png 960w" sizes="(max-width: 625px) 100vw, 625px" /></a></p>
<p>I used the bracket page notation to define the first page of the pdf in the last two commands, filename.pdf[0] (zero index). It&#8217;s possible to do the entire PDF at once by removing it.</p>
<pre class="brush:bash"># Create high quality thumbnail images for a pdf
f="my.pdf"; convert -density 300 $f -quality 100 -resize 960x +adjoin $f-%02d.png</pre>
<p>We can toss this in a for loop to perform the operation on a bunch:</p>
<pre class="brush:bash"># Create high quality thumbnail images from multiple pdfs
for f in *.pdf; do convert -density 300 $f -quality 100 -resize 960x +adjoin $f-%02d.png; done</pre>
<p>If you&#8217;re still having issues with quality, you can play with the the -scale parameter, adding it after the -quality setting, i.e. &#8220;-scale @1500000&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2013/03/12/creating-high-quality-thumbnails-for-pdfs-in-linux-using-imagemagick%ef%bb%bf%ef%bb%bf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery and jQuery UI in your Grease Monkey scripts.</title>
		<link>http://www.doknowevil.net/2011/07/16/jquery-and-jquery-ui-in-your-grease-monkey-scripts/</link>
		<comments>http://www.doknowevil.net/2011/07/16/jquery-and-jquery-ui-in-your-grease-monkey-scripts/#respond</comments>
		<pubDate>Sat, 16 Jul 2011 01:25:35 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[The Internet]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[client-side hack]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[fix websites]]></category>
		<category><![CDATA[grease monkey]]></category>
		<category><![CDATA[lifehack]]></category>
		<category><![CDATA[stylish]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=985</guid>
		<description><![CDATA[Not all websites are made equal. Unfortunately, some of those websites are ones we&#8217;re required to use. Be it our job, our interests or the undiscovered, web-browsing can be the orgeon trail of the internet. Cultivating the atmosphere to work for us and bringing the right tools along for the journey are essential for survival, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Not all websites are made equal.  Unfortunately, some of those websites are ones we&#8217;re required to use.  Be it our job, our interests or the undiscovered, web-browsing can be the <em>orgeon trail</em> of the internet.  Cultivating the atmosphere to work for us and bringing the right tools along for the journey are essential for survival, if you&#8217;re a pioneer.</p>
<p>I&#8217;m tired of websites that don&#8217;t provide, can&#8217;t provide or will never provide.   I&#8217;ve called in my boys, <a href="https://addons.mozilla.org/en-US/firefox/addon/stylish/" target="_blank" title="create your own css for websites">Stylish</a> and <a href="https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/" target="_blank" title="create your own javascript for websites">Grease Monkey</a> on the front lines.  However, beyond the crazy happenstance that another user might share a solution to your issue on <a href="http://userstyles.org" title="user styles for stylish" target="_blank">userstyles.org</a> or <a href="http://userscripts.org" title="user scripts for grease monkey" target="_blank">userscripts.org</a> you could be left in the cold, without the right tools.  I won&#8217;t go into detail on Stylish in this post but you might not even need it after you see the script.</p>
<p>Since I&#8217;m already connected with Google every which way in my life, why not pretend like the Internet is a big party and websites are your friends.  Introduce jQuery from Google&#8217;s CDN to other friends (websites) that don&#8217;t already know jQuery and jQuery UI and <em>make it personal</em>.</p>
<p>That was the driving force behind this <strong>Grease Monkey Script</strong>, which was derived from mashing together <a href="http://strd6.com/2009/02/how-to-load-jquery-ui-css-in-greasemonkey/">strd6&#8217;s script</a> and <a href="http://joanpiedra.com/jquery/greasemonkey/">Joan Piedra&#8217;s script</a> with an update to the latest versions of jQuery and jQuery UI.</p>
<pre class="brush:javascript">
// ==UserScript==
// @name           jQuery and jQuery UI
// @author         Tyler "-z-" Mulligan
// @version        0.5
// @namespace      http://www.doknowevil.net
// @description    jQuery 1.6.2 and jQuery UI 1.8.4 loaded from google's CDN with redmond theme.
// @include        http://www.website.com/*
//
// @resource       jQuery               https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// @resource       jQueryUI             https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js
//
// @resource       jQueryUICSS          http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/jquery-ui.css
//
// @resource       ui-bg_inset-hard_100_fcfdfd_1x100.png  http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
// @resource       ui-bg_gloss-wave_55_5c9ccc_500x100.png http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
// @resource       ui-bg_glass_85_dfeffc_1x400.png        http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_glass_85_dfeffc_1x400.png
// @resource       ui-bg_glass_75_d0e5f5_1x400.png        http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png
// @resource       ui-bg_inset-hard_100_f5f8f9_1x100.png  http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
// @resource       ui-bg_flat_55_fbec88_40x100.png        http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_flat_55_fbec88_40x100.png
// @resource       ui-bg_glass_95_fef1ec_1x400.png        http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_glass_95_fef1ec_1x400.png
// @resource       ui-icons_469bdd_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_469bdd_256x240.png
// @resource       ui-icons_469bdd_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_469bdd_256x240.png
// @resource       ui-icons_d8e7f3_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_d8e7f3_256x240.png
// @resource       ui-icons_6da8d5_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_6da8d5_256x240.png
// @resource       ui-icons_217bc0_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_217bc0_256x240.png
// @resource       ui-icons_f9bd01_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_f9bd01_256x240.png
// @resource       ui-icons_2e83ff_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_2e83ff_256x240.png
// @resource       ui-icons_cd0a0a_256x240.png            http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-icons_cd0a0a_256x240.png
// @resource       ui-bg_flat_0_aaaaaa_40x100.png         http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png
// @resource       ui-bg_flat_0_aaaaaa_40x100.png         http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png

// ==/UserScript==

var $;

// Inject jQuery into page... gross hack... for now...
(function() {
    if (typeof unsafeWindow.jQuery == 'undefined') {
        var head = document.getElementsByTagName('head')[0];
 
        var script = document.createElement('script');
        script.type = 'text/javascript';
 
        var jQuery = GM_getResourceText('jQuery');
        var jQueryUI = GM_getResourceText('jQueryUI');
 
        script.innerHTML = jQuery + jQueryUI;
        head.appendChild(script);

    }
    GM_wait();
})();
   
// Check if jQuery's loaded
function GM_wait() {
    if (typeof unsafeWindow.jQuery == 'undefined') {
        window.setTimeout(GM_wait, 100);
    } else {
        $ = unsafeWindow.jQuery.noConflict(true);
        addUIStyles();
        letsJQuery();
    }
}

function addUIStyles() {
    var head = document.getElementsByTagName('head')[0];
    var resources = {
        'ui-bg_inset-hard_100_fcfdfd_1x100.png': GM_getResourceURL('ui-bg_inset-hard_100_fcfdfd_1x100.png'),
        'ui-bg_gloss-wave_55_5c9ccc_500x100.png': GM_getResourceURL('ui-bg_gloss-wave_55_5c9ccc_500x100.png'),
        'ui-bg_glass_85_dfeffc_1x400.png': GM_getResourceURL('ui-bg_glass_85_dfeffc_1x400.png'),
        'ui-bg_glass_75_d0e5f5_1x400.png': GM_getResourceURL('ui-bg_glass_75_d0e5f5_1x400.png'),
        'ui-bg_inset-hard_100_f5f8f9_1x100.png': GM_getResourceURL('ui-bg_inset-hard_100_f5f8f9_1x100.png'),
        'ui-bg_flat_55_fbec88_40x100.png': GM_getResourceURL('ui-bg_flat_55_fbec88_40x100.png'),
        'ui-bg_glass_95_fef1ec_1x400.png': GM_getResourceURL('ui-bg_glass_95_fef1ec_1x400.png'),
        'ui-icons_469bdd_256x240.png': GM_getResourceURL('ui-icons_469bdd_256x240.png'),
        'ui-icons_469bdd_256x240.png': GM_getResourceURL('ui-icons_469bdd_256x240.png'),
        'ui-icons_d8e7f3_256x240.png': GM_getResourceURL('ui-icons_d8e7f3_256x240.png'),
        'ui-icons_6da8d5_256x240.png': GM_getResourceURL('ui-icons_6da8d5_256x240.png'),
        'ui-icons_217bc0_256x240.png': GM_getResourceURL('ui-icons_217bc0_256x240.png'),
        'ui-icons_f9bd01_256x240.png': GM_getResourceURL('ui-icons_f9bd01_256x240.png'),
        'ui-icons_2e83ff_256x240.png': GM_getResourceURL('ui-icons_2e83ff_256x240.png'),
        'ui-icons_cd0a0a_256x240.png': GM_getResourceURL('ui-icons_cd0a0a_256x240.png'),
        'ui-bg_flat_0_aaaaaa_40x100.png': GM_getResourceURL('ui-bg_flat_0_aaaaaa_40x100.png'),
        'ui-bg_flat_0_aaaaaa_40x100.png': GM_getResourceURL('ui-bg_flat_0_aaaaaa_40x100.png')
    };
    
    var style = document.createElement('style');
    style.type = 'text/css';
    
    var css = GM_getResourceText ('jQueryUICSS');
    $.each(resources, function(resourceName, resourceUrl) {
        console.log(resourceName + ': ' + resourceUrl);
        css = css.replace( 'images/' + resourceName, resourceUrl);
    });
    
    style.innerHTML = css;
    head.appendChild(style);
}

// All your GM code must be inside this function
function letsJQuery() {
    //alert($); // check if the dollar (jquery) function works
    //alert($().jquery); // check jQuery version
    $("<div id='example' class='flora' title='This is my title'>I'm in a dialog!</div>").dialog({
        buttons: {
            "Ok": function() {
                alert("Ok");
            },
            "Cancel": function() {
                $(this).dialog("close");
            }
        }
    });
}
</pre>
<p>I also wanted to use this script with Chromium browser, the open-source version of <a href="http://www.google.com/chrome/" target="_blank">Google Chrome</a>.  I found the <a href="https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo" target="_blank">TamperMonkey Extension for Chrome</a>.  <a href="https://chrome.google.com/webstore/detail/fjnbnpbmkenffdnngjfgmeleoegfcffe" target="_blank">Stylish</a> is also available for Chrome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2011/07/16/jquery-and-jquery-ui-in-your-grease-monkey-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating CSS Based on Images, also SEO-Friendly</title>
		<link>http://www.doknowevil.net/2011/02/20/generating-css-based-on-images-also-seo-friendly/</link>
		<comments>http://www.doknowevil.net/2011/02/20/generating-css-based-on-images-also-seo-friendly/#respond</comments>
		<pubDate>Sun, 20 Feb 2011 17:19:05 +0000</pubDate>
		<dc:creator><![CDATA[Tyler Mulligan]]></dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[generation]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.doknowevil.net/?p=977</guid>
		<description><![CDATA[I&#8217;ve typed out a lot of CSS that&#8217;s focused on using a background image to replace text. I&#8217;ve been using a cross-browser CSS trick that&#8217;s SEO-friendly, I&#8217;m not sure if it&#8217;s documented anywhere. I came upon the solution myself when I was searching for a clever way to do this years ago and it&#8217;s become [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve typed out a lot of CSS that&#8217;s focused on using a background image to replace text.  I&#8217;ve been using a cross-browser CSS trick that&#8217;s SEO-friendly, I&#8217;m not sure if it&#8217;s documented anywhere.  I came upon the solution myself when I was searching for a clever way to do this years ago and it&#8217;s become the standard method for me.  However, I dislike the tedious task of typing out the CSS and referencing the image pixels and at work, I don&#8217;t want my developers wasting that time either.</p>
<p>I figured it&#8217;d be best to come up with a simple solution, so I started coding something out in bash and it worked:</p>
<pre class="brush:bash">#!/bin/bash
# css.sh - generate common css and html
# Tyler Mulligan (z@interwebninja.com)
# Last Update: 02/16/2011
# MIT License

create_block_image() {
    feh -lr ${1:-.} | awk '{ print $3" "$4" "$8 }' | sed '1d' | while read l; do N=$((N+1));
        cbi_css $l
    done
    feh -lr ${1:-.} | awk '{ print $3" "$4" "$8 }' | sed '1d' | while read l; do N=$((N+1));
        cbi_html_a $l
    done
    feh -lr ${1:-.} | awk '{ print $3" "$4" "$8 }' | sed '1d' | while read l; do N=$((N+1));
        cbi_html_div $l
    done
}
cbi_css() {
    f=${3##*/}
    echo "#${f%.*} {
    display: block;
    background: url('$3') no-repeat 0 0;
    width: 0;
    height: $2px;
    padding-left: $1px;
    overflow: hidden;
}"
}
cbi_html_a() {
    f=${3##*/}
    echo "<a href=\"#\" id=\"${f%.*}\" alt=\"$f\" title=\"$f\">${f%.*}</a>"
}
cbi_html_div() {
    f=${3##*/}
    echo "<div id=\"${f%.*}\"></div>"
}


s=$1; shift; case $s in
  --image-block|--cbi|-i) create_block_image $@;;
  *) help help;;
esac</pre>
<p>Which ouputs something like:</p>
<pre class="brush:bash">
z@zygon:~/scripts/css$ ./css.sh -i img/
#dumbtubes-fav {
    display: block;
    background: url('img/dumbtubes-fav.png') no-repeat 0 0;
    width: 0;
    height: 14px;
    padding-left: 16px;
    overflow: hidden;
}
#submit_new {
    display: block;
    background: url('img/submit_new.png') no-repeat 0 0;
    width: 0;
    height: 106px;
    padding-left: 244px;
    overflow: hidden;
}
#dumbtubes-logo {
    display: block;
    background: url('img/dumbtubes-logo.png') no-repeat 0 0;
    width: 0;
    height: 70px;
    padding-left: 274px;
    overflow: hidden;
}
<a href="#" id="dumbtubes-fav" alt="dumbtubes-fav.png" title="dumbtubes-fav.png">dumbtubes-fav</a>
<a href="#" id="submit_new" alt="submit_new.png" title="submit_new.png">submit_new</a>
<a href="#" id="dumbtubes-logo" alt="dumbtubes-logo.png" title="dumbtubes-logo.png">dumbtubes-logo</a>
<div id="dumbtubes-fav"></div>
<div id="submit_new"></div>
<div id="dumbtubes-logo"></div></pre>
<p>To explain the way this CSS works, it uses the padding-left as the actual width, setting the width 0 and then pushes whatever content you have out of view using overflow:hidden to hit it from view.  This makes it easy for search engines, keeping your HTML clean and CSS simple.</p>
<p>The bash script relies of &#8220;feh&#8221; a lightweight image viewer for linux that outputs a list of images and their dimensions.  It also generates some sample HTML to quickly drop in and modify.</p>
<p>This is not an elegant solution and I&#8217;m not happy with the fact that it relies on feh.  I&#8217;ve been slowly getting into python and I was amazed at how fast I was able to recreate this script in Python.</p>
<pre class="brush:python">#!/usr/bin/python
# css.py - generate common css and html
# Tyler Mulligan (z@interwebninja.com)
# Last Update: 02/17/2011
# MIT License
from PIL import Image
import sys
import os.path

CSS_FORMAT = """#%s {\n\
    display: block;\n\
    background: url('%s') no-repeat 0 0;\n\
    height: %spx;\n\
    width: 0;\n\
    padding: %spx;\n\
    overflow: hidden;\n\
}\n"""

HTML_A_FORMAT = """<a href="#" id="%s" alt="%s" title="%s">%s</a>\n"""
HTML_DIV_FORMAT = """<div id="%s">%s</div>\n"""

css=""
html_a=""
html_div=""
for tf in os.listdir(sys.argv[1]):
    f = os.path.join(sys.argv[1],tf)
    if os.path.isfile(f) == True :
        img = Image.open(f)
        fid = os.path.splitext(tf)[0]
        (width, height) = img.size[0:2]
        css += CSS_FORMAT % (fid,f,height,width)
        html_a += HTML_A_FORMAT % (fid,f,fid,fid)
        html_div += HTML_DIV_FORMAT % (fid,fid)

print css
print html_a
print html_div </pre>
<p>This is just the basic idea, I didn&#8217;t spend more than 15 minutes on this rewrite, it does what I need it to do so far.  It was suggested by friends if I make it any bigger, to look into a templating engine, such as mako.  I hope this script can be useful to someone :). PS, HTML_DIV_FORMAT should be on one line, not sure why my syntax highlighter is trying to put it on 3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doknowevil.net/2011/02/20/generating-css-based-on-images-also-seo-friendly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching using disk
Object Caching 862/936 objects using disk

 Served from: www.doknowevil.net @ 2016-09-02 17:57:10 by W3 Total Cache -->