Skip to content

Instantly share code, notes, and snippets.

View jdorfman's full-sized avatar

Justin Dorfman jdorfman

View GitHub Profile
@jdorfman
jdorfman / gist:2474890
Created April 24, 2012 00:26
my new favorite utility
mutt -s "Birthday celebration" -a citymap.jpg all@friends.org \
< invitation.txt
$ mkdir -p {1..3}/{1..3}
# Result:
$ tree
.
|-- 1
| |-- 1
| |-- 2
| `-- 3
|-- 2
@jdorfman
jdorfman / gist:2501118
Created April 26, 2012 17:26 — forked from netdna/gist:2501099
nginx - return a 403 response for certain referers
#place this in nginx.conf or a vhosts
if ($http_referer ~* (keyword|domain.com|www.domain.com))
{ return 403; }
@jdorfman
jdorfman / gist:2505372
Created April 27, 2012 03:14
Nginx vhosts RegEx
# place this in a nginx vhosts && service nginx reload
location ~ ^/path/to/files/img.*\.jpg$ {
alias /usr/local/nginx/html/suspend.html;
}
# transfer large files in half the time with lftp. SCP and Rsync can't touch this.
lftp -e 'pget -n4 sftp://user:passwd@ftp.server.com/tmp/bigfile.tgz'
Microsoft is a failed company? They have had products that failed (so has every other successful company). But with a $269 Billion market cap, I don't think they are failed company as of today... Maybe they are becoming irrelevant, it really depends on your perspective. Like it or not hey still have the seventh most visited site in the world (live.com), the largest browser market share @ 27.95% (as of March 2012), and 85% of the OS market.
Don't get me wrong, the only thing I use from Microsoft is their optical mouses (I think they are the best IMO). But they are far from a failed company. Barnes and Noble on the other hand...
Sources:
https://www.google.com/finance?client=ob&q=NASDAQ:MSFT
http://www.netmarketshare.com/operating-system-market-share.aspx?qprid=10
http://www.alexa.com/topsites
http://en.wikipedia.org/wiki/Usage_share_of_web_browsers
@jdorfman
jdorfman / gist:2571878
Created May 1, 2012 22:15
Find the version number of nginx on a cluster
for i in 01 02 03 04 05; do echo "${i}" && ssh web${i}.yourdomain.com '/usr/local/nginx/sbin/nginx -v'; done
# Output:
# 01
# nginx version: nginx/1.0.11
# 02
# nginx version: nginx/1.0.11
# 03
# nginx version: nginx/1.0.11
Sometimes a certain theme won't allow CDN integration with a particular plugin. Here is a list of plugins you can try:
http://wordpress.org/extend/plugins/ossdl-cdn-off-linker/
http://wordpress.org/extend/plugins/cdn-sync-tool/
http://wordpress.org/extend/plugins/wordpress-cdn-rewrite/
http://wordpress.org/extend/plugins/w3-total-cache/
http://wordpress.org/extend/plugins/wp-super-cache/
mysql> update wp_database.wp_posts set post_content = replace(post_content,'find_this_string','replace_with_this_string');
# If a uri has spaces e.g. /all/files/preview-images/May/aws%20blocks.png
# Make sure you have $request_uri before $is_args$args or the file will 404
proxy_pass http://$backend$request_uri$is_args$args;