One of the more routine annoyances of a long day in the terminal is banging out some long command that happens to operate on a file your current user doesn’t have access to.
You declined to sudo the command because you you forgot, were feeling cautious, or were unaware of the permissions bits of the file(s) in question. Now you have to type it again, or switch gears and start up some cursor navigation to prepend your sudo.
Next time, as an easy to use alternative, try:
sudo !!
In bash, !! expands to the last run command. sudo !! sudo’s the last command. That was easy.
Not a tip that is strictly bash related, but useful nonetheless. For those struggling to fix error messages on their Ubuntu whining about of an inability to set locale .
Error message: perl: warning: Setting locale failed.<br/>
perl: warning: Please check that your locale settings:<br/>
...<br/>
perl: warning: Falling back to the standard locale ("C").<br/>
Want some nice headphones, but don’t want to feel like a sucker? Check out these Denon AH-D1000K cans. They’re amazingly comfortable and provide a MUCH better sound. Seriously.
I’m pretty sure “noise cancellation technology” isn’t worth $250 to the average iPod owner. Check out this review at headphone.com for a more qualified opinion than mine.
Here is a great post by Mathieu Martin about how to use Git to maintain and extend a long term fork of a project.
Recently at GiraffeSoft we started a new project, based on another existing project we already had going. We could call this a long term fork.
I’m sure you’ve done this before. You were probably using Subversion, and your project is probably 2 years behind HEAD of the original project.
Your invariants probably looked something like this:
* These projects will both keep being actively developed in the future;
* They will have some fundamental differences that will not be reconciled;
* They will however keep many similarities and we expect that they will benefit from the exchange of some specific patches, as development on both moves forward.
This happens all the time, especially in web development. You find a fantastic open source project to base your project on, but you need to customize and extend it. You also want to easily incorporate future features and bug fixes from the original project as they’re developed.
In days past, this problem could have been solved reasonably well by cloning the central repository and then exchanging patches and applying them manually.
I’ve tried this before. Remember that scene in the Dark Knight where the Joker makes the pencil disappear? It’s kinda like that.
As you’ve guessed already, we’ve decided to try using Git to help manage this long term relationship.
It’s still not going to be easy unless you control both projects, but using a setup like Martin describes will be much easier than checking the man page for patch as you try to merge in new features by hand.
Getting started with Git? Git for the lazy is one of the better starting points we’ve seen [via SvN].
There are a million Git cheat-sheets out there, but this one does a pretty good job at picking the more intuitive way of performing a particular task, and showing some sample commands to get it done. The How To Fix Mistakes section is particularly useful, and succint:
Haven't committed yet, but don't want to save the changes?
You can throw them away:
git reset --hard
You can also do it for individual files, but it's a bit different:
git checkout myfile.txt
Forgot something in your last commit? That's easy to fix.
git reset --soft HEAD^
Then write over the last commit:
git commit --amend
Don't make a habit of overwriting/changing history if
it's a public repo you're working with, though.
If I read another post with a laundry list of why git is useful, each bullet linking me to the man page, I’m going to scream. How much time do you think I have?
There is no shortage programmers coming over from Subversion who feel confused and perplexed by all that Git has to offer. My biggest complaint about Git is that there are quite a number of ways to accomplish a specific task, and it’s not always clear that the best practices are.
They want to deliver vast amounts of information over the Internet. And again, the Internet is not something that you just dump something on. It’s not a big truck. It’s a series of tubes. And if you don’t understand, those tubes can be filled and if they are filled, when you put your message in, it gets in line and it’s going to be delayed by anyone that puts into that tube enormous amounts of material, enormous amounts of material.
Elsewhere on the market, big truck futures were up in heavy trading.
The New York Times quotes an amazing statistic today: San Francisco recycles 69% of all landfill bound waste. Even more surprising is our national average is 32%. Nearly 1/3rd of the waste we throw away gets sorted out and somehow recycled or reused.
Houston, bucking the trend, seems to rebel “against mandates or anything that seems trendy or hyped up” with their meager 2.6% rate. Recycling is trendy. Who knew?
Houston recycles just 2.6 percent of its total waste, according to a study this year by Waste News, a trade magazine.
City officials cite the difficulties surrounding the effort: expensive collection, little public support, high cost of fuel for collection in a sprawled urban environment. Also, a ludicrous argument from Houston’s Mayor, Bill White, about their “independent streak” keeping them from recycling.
The most interesting part of the article is this graphic showing recycling rates for other major urban centers across the country. San Francisco manages to achieve a 69% recycling rate across all landfill bound waste.
Click for full graphic
Seems too good to be true? I thought so. After a bit of research, I found this press release from the SF Mayors office confirming the numbers.
Recycling is simply part of life in San Francisco, with new statistics showing that the city kept 69 percent of all waste-stream materials from going to the landfill, up from 67 percent the year before. The most significant gains were in the areas of commercial recycling, and the collection of compostable food scraps and yard trimmings.
The figures, compiled by the City’s Environment Department (SF Environment) and approved by the California Integrated Waste Management Board, show that San Francisco generated 1,978,748 tons of waste material in 2005. Of this, 664,033 tons went to landfill, while 1,367,013 tons were diverted through recycling, composting, reuse, source reduction and other efforts.
Ever wonder how you get a new sport into the Olympics? The BBC seems to think that one way to do it is with cash. Big, million dollar stacks of cash. They claim that a Japanese cycling association paid $3,000,000 to cycling’s international governing body (the UCI) to get the “keirin” included in the slate of Olympic velodrome events.
I don’t really care about the scandal. I assume that everything about the Olympics preparation, from the venue to the events, is decided by bribery. It’s just a good segue for me to explain how awesome the keirin is. It works like this: the racers have to stay behind a pace setter (who rides either a bike or motorcycle) for most of the race. The pace setter starts out going medium-slow (about 20 mph), and over the course of about 8 minutes slowly ratchets the speed up to 30+ mph. The cyclists jockey for the prime position, right behind the pace setter. Then, at a prederminded spot about a half mile from the finish, the pace setter pulls off the course and it’s a free for all.
Check out this video (1:33) and you’ll get the idea. The action starts with the pace setter (in purple) pulling off the track.
The Japanese had to pay $3,000,000 to get that in the Olympics? Who wouldn’t want that in the Olympics? How much did Russia have to pay to get Rhythmic Gymnastics in the Olympics?
We need to do a better job about posting helpful hints for our SftpDrive users. Thus begins a series of posts aimed at that.
Automatic License Distribution & Installation
To help ease the task of installing SftpDrive for large groups of users we’ve introduced a method to easily package your license key such that it is automatically installed.
As of version 1.7.9 of SftpDrive you can easily package and install your license by creating a file named SftpDriveLicense.txt that resides in the same directory as the installer. Paste your license key into that file and it will be picked up by the installer and automatically installed. This saves you the trouble of having yourself or users enter the serial number during the first run.
It’s really too bad LogMeIn had to buy [suck the life out of] Hamachi. Hamachi lets you easily [really easily] setup your own virtual private network. It lets you link together remote computers as if they were on the same local network, no matter where they are, or what router they might be behind. Its one of those rare pieces of technology that magically “just works”
Install Hamachi on any of your machines - it runs on Mac/Windows/Linux.
You are automatically assigned a static virtual IP address in the 5.x.x.x address space
Create or connect to a network - which has a name of your choosing, and is password protected.
Enjoy
On a Mac, that means wonderful things like iTunes music sharing work directly across the internet. No matter where where your computers are - you can see whoever is on the network as long as they have an internet connection. You can also immediately access a screen sharing or file sharing session through finder with a click of a button, whether the machine is next to you - or on the other side of the world.
It’s really great. And it really IS that easy.
Some helpful hints on installation:
The easiest way to get up in running is by using the installer in the [ugly] HamachiX graphical front end. Their documentation walk you through everything. For an even better experience, configure Hamachi to startup at boot with these instructions hosted over at GitHub