Staging the removal of all missing files
git diff —diff-filter=D —name-only | xargs git rm
You use filter-branch to replay the whole history with a filter applied (git filter-branch —tree-filter ‘rm -f file_to_immolate’). Then you remove the original refspec saved by filter-branch (rm -rf .git/refs/original). Then you run garbage colleciton to remove the objects that are no longer referenced. (git gc)
And suddenly you’re clean.
Also useful if you’ve been mucking about: Repack/Unpack/Prune/etc…
Getting weird errors about 1005 and/or 150, “can’t create table #blahblahblah”? Perhaps MySQL can’t find the index on the column in your target table:
I needed to create an additional index even though my referenced column was the primary key. No idea why yet, but I figured I’d record this.
Amazed to report that, having never created a Python program longer than “hello world” and within an hour of starting, I was able to research and implement a Python script that imports arbitrary CSV files into a sqlite database for more sane analysis. Go Python!
I’ve been starting to think I should be writing a bit more, and things like this (http://www.copyblogger.com/bad-writing-habits/) keep popping up for me and sparking this feeling even more. I think I’ll use it to help structure my workweek better as well.
PHP’s boolean literals (true and false) are completely case-insensitive. Cool!
du -xakm /|sort -rn|head -500 > bigfiles.txt
This saves (quickly!) a list of the 500 biggest files on your Linux / Unix / Mac OSX system, along with their size in megabytes, and organizes them with the largest at the top. Cool!
It’s saving me this evening - thanks go out to a commenter named georges at http://www.cyberciti.biz/faq/find-large-files-linux/
And the box says “Contains Orange Juice from the U.S. and Brazil.”
Why is it that food safety rules are so focused on points of failure rather than systemic problems?
What if we mashed the Brazillian oranges _separately_ from the U.S. oranges? Perhaps the inevitable lapses in food safety would be identified and quashed faster than the absurdly broad contaminations we have now that result in the wholesale destruction of tons and tons of food.
Just a thought. One glass of orange juice simultaneously from the U.S. and Brazil, harumph.
Phenomenally useful post by a guy named Max Dunn in his blog “Eschew Obfuscation”.
The gist of the usefulness for me:
- Let’s say people are accessing your site on the url http://site.com/coolpage and you need to rewrite that to http://site.com/index.php/coolpage
- When your RewriteRule directive is in a conf file, it will be matching against “/coolpage”
- When the directive is in a .htaccess file located in the document root for site.com, it will be matching against “coolpage”
I thought it was pretty weird behavior until I realized: the .htaccess rules will only be applied to requests for things within the site.com document root, (making the leading slash irrelevant information) whereas the the conf files are potentially server-wide.
Here’s what you’d probably use in each case:
Apache conf file:
RewriteRule ^/(.*)$ index.php?/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]