My Favorite Spool Presentation
Complete, with audio, by the brilliant Jared Spool.
Working with Git on Dreamhost
Preamble
Though I gained most of these insights by reading this very informative site, I need to retype things in my own words to catalog my own trials and tribulations while satisfying my own thought process (or lack-thereof). Mind you, I’m not adding much (if anything) to the original post…just my own perspective and tailored to a Dreamhost environment.
Prerequisites
No one likes passwords and all of the baggage attached to them (e.g. typing them, changing them, etc…). To avoid typing passwords when connecting to the server (which becomes a requirement/necessity for git a bit later on) we generate public/private keys using ssh-keygen:
$ ssh-keygen -t rsa -C "user@email.com"
NB: I’m not going to go into the particulars of RSA. Wikipedia has a pretty good primer.
Executing the command generates a sequence of password requests followed by the generated key fingerprint and randomart image (example output shown below with sensitive bits removed and set off by asterisks):
Generating public/private rsa key pair. Enter file in which to save the key (/Users/username/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/username/.ssh/id_rsa. Your public key has been saved in /Users/username/.ssh/id_rsa.pub. The key fingerprint is: *fingerprint* The key's randomart image is: *randomart*
You’ll need to move ~/.ssh/id_rsa.pub to the server as it will be needed later in the process.
Setting Up Gitosis
Before starting, it’s important to note 2 things:
- Wherever you put Gitosis, it will take over the account preventing you from ssh-ing into it directly.
- When you connect to the repository, the full path to the location where the files are kept is not necessary (and it will fail).
All of the following instructions take place on the server hosting the repository. First, create a src folder to store all the bits of code:
$ mkdir ~/src $ cd ~/src
Download the latest version of git:
$ wget http://kernel.org/pub/software/scm/git/git-1.7.0.2.tar.gz
Decompress the file:
$ tar -xvvzf git-1.7.0.2.tar.gz
Change to the new directory and install:
$ cd git-1.7.0.2 $ ./configure -prefix=$HOME/local NO_MMAP=1 $ make $ make install
NB: Your prefix path may be different depending on your preferences. You’ll want to specify the root of the directory that contains (if they currently exist) the bin, lib, and similar directories.
Create a directory to contain localized Python additions.
$ mkdir -p ~/local/lib/python2.4/site-packages
Add these additions to .bashrc and .bash_profile:
# lines for gitosis export PYTHONPATH=$HOME/local/lib/python2.4/site-packages/ export PATH=$HOME/local/bin:$PATH
Before installing Python setuptools, you can add a .pydistutils.cfg file that adds a bit more fine-grained control to this (and future) installation. You can create this file with your editor-of-choice or by executing the following lines:
$ echo "[install]" >> ~/.pydistutils.cfg $ echo "install_lib = ~/local/lib/python\$py_version_short/site-packages" >> ~/.pydistutils.cfg $ echo "install_scripts = ~/local/bin" >> ~/.pydistutils.cfg
The previous lines create a .pydistutils.cfg which looks like this:
[install] install_lib = ~/local/lib/python$py_version_short/site-packages install_scripts = ~/local/bin
As an example, in an environment using Python version 2.4.4, libraries would be installed to ~/local/lib/python2.4/site-packages.
After setting up the optional config, install Python setuptools (setuptools-0.6c11-py2.4.egg was the latest version at the time of writing):
$ cd ~/src $ wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg $ sh setuptools-0.6c11-py2.4.egg
Install the latest version of Gitosis:
$ cd ~/src $ git clone git://eagain.net/gitosis.git $ cd gitosis/ $ python setup.py install --prefix=$HOME/local
Using your publickey, initialize Gitosis:
$ gitosis-init < id_rsa.pub
There still remains one minor problem: the permission on the post-update hook:
$ chmod 755 ~/repositories/gitosis-admin.git/hooks/post-update
NB: This issue was supposedly fixed with a newer version of setuptools, but I still ran into the issue.
Now, everything should be configured correctly.
Using Gitosis
Gitosis, by default, puts everything into a repositories directory. Git is used to administer Gitosis, so it’s necessary to checkout the Gitosis Admin project. On your local computer:
$ cd ~/your_projects_directory $ git clone user@domain.tld:gitosis-admin.git $ cd gitosis-admin
To add a repository or add a user to a group, the file to edit is gitosis.conf. Below is an example configuration:
[gitosis] # just for initial testing, set the loglevel to DEBUG loglevel = DEBUG # if none of the repositories are going to use gitweb gitweb = no # if git-daemon isn't running daemon = no # the default group [group gitosis-admin] writable = gitosis-admin members = user1 # another user group [group anothergroup] # the repository to write to writable = newrepository # refers to the previous group and adds another user for just this project members = @gitosis-admin user2 # a new repository [repos newrepository] owner = Some Owner description = Description of the project
The users refer to the keys in the keydir. If any new users are to be added to the project, their public keys must be added to the keydir and the names added to the appropriate groups in gitosis.conf. Gitosis handles all access control.
Push the new config changes:
$ git commit -am 'Added new group and new repository. Also added new user key.' $ git push
Everything should work fine. Now to add the new repository.
$ cd ~/your_projects_directory $ mkdir newrepository $ git init $ git remote add origin user@domain.tld:newrepository.git # add new files, commit, etc... $ git push origin master:refs/heads/master
The line git push origin master:refs/heads/master is only necessary the first time. Once the link is established, every subsequent push should just entail a git push.
Pitfalls During Installation
After configuring everything, I attempted to create a new repository. This is where I started running into problems:
ERROR:gitosis.serve.main:Repository read access denied fatal: The remote end hung up unexpectedly
The issue was a conflicting line in the authorized_keys file (i.e. an original key that I added to the server to ease the login process).
Then I ran into this problem:
fatal: 'repositories/newrepos.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly
I was adding the path repositories without realizing that referring to it was unnecessary.
The biggest issue I ran into, and it was extremely irritating since it returned false positives, was assuming the post-update hook issue was fixed with the latest setuptools. It wasn’t. During a push, it looks like everything is updating fine in git, but no changes are being made on the remote server.
Hope this all was helpful.
No commentsRegarding window.location
I ran across something new (at least, new to me) today. Using window.location.hash, if the same value is being assigned to the hash, the browser looks at it as a non-operation. The value needs to be reset first before reassigning the same value (e.g. for the purpose of resetting the view to the top of a dynamic list). I’ve noticed this behavior in Firefox 3 and Safari 3+.
I rarely write about coding issues, but it might be a good way to catalog my findings for my own reference. My apologies to everyone else.
Update: I thought this could use an example.
var hashVar = 'content-top';
// ASSERT: hashVar contains the same value as window.location.hash
window.location.hash = hashVar;
// Expected behavior: Window scrolls back to the 'content-top' id
// Demonstrated behavior: Window does nothing
The way that I solved this was to reset the window.location.hash value to an empty string before the reassignment.
var hashVar = 'content-top';
window.location.hash = 'adkcj';
window.location.hash = hashVar;
// Expected behavior: Window scrolls back to the 'content-top' id
// Demonstrated behavior: Window scrolls back to the 'content-top' id
Update 2: Apparently, Firefox, in the latest update, changed the behavior of the hash property. If the value is “zero-ed out”—if you will—the entire page refreshes. I’ve amended the script above so that hash is given a (hopefully) non-id value. Feel free to use a real word, but I didn’t want to take the off-chance of hitting an id I’m using.
2 commentsSuppression on Facebook
These two Facebook pages (here and here), the former of which has–ironically, perhaps–declared war on the latter, ignited quite a debate. Here’s a list of my initial thoughts before I start analyzing this:
- I don’t consider soldiers hired thugs.
- I am aware that some soldiers commit atrocities, which is a reality few people admit. Given the conditioning soldiers endure, coupled with varying levels of power over peers, subordinates, and/or civilians, situations (read: Abu Ghraib) similar to the Stanford Prison Experiment appear inevitable.
- I consider war an atrocity (though sometimes a necessary evil), but smaller governing bodies shoulder the blame for initiating it, not the soldiers.
- I am a firm believer in freedom of speech, almost without exception.
The Iraq war is a cauldron of controversy. It started with a retaliation in Afghanistan for the events of 9/11 and, under false pretense, spilled over into Iraq. Though history has yet to ascertain the damage, it may prove to be one of the most costly and unpopular wars, ever. The Iraq war sparked a ideological issue between those that whole-heartedly support the troops versus those who disapprove of supporting the greater cause and preceding events. The “Soldiers are not heroes” profile picture is a silhouette of Satar Jabar, perched on his box, alluding to one of the most politically disastrous events for the military.
The charge against “Soldiers are not heroes” (SANH) by “Petition to REMOVE “Soldiers are not heroes” from Facebook” (PTRS) is they are using “Hate Speech and Defamatory Comments towards Allied Service Members.” Hate speech, even if meant to result in physical harm, is still–with a few exceptions–protected by the First Amendment. Interestingly enough, PTRS mentions that they “[are] not against “Freedom of Speech.” In order to argue their case, PTRS needs to prove SANH’s comments are, either, defamatory or against Facebook conduct guidelines (which I haven’t read as of this post).
SAHN’s page states (discounting wall posts and links since the source may or may not be the views of the creators):
Does the thought of hero worshiping our armed forces make you want to vomit your spleen out?
Are you fed up of being told that soldiers deserve constant gushing praise?
Stand up and show members of the armed forces what you really think of them and their participation in needless bloodshed.
Though meant to be offensive, the above contains nothing that could be interpreted as hate speech. The group requests that its members wear t-shirts with extremely controversial slogans (e.g. ”Proud not to murder civilians for a living,” ”I was raped by soldiers and all I got was this lousy t-shirt,” etc.). Unfortunately, because of the satirical nature and debatable validity of these statements, it, again, would be difficult to prove any of these as defamatory. To clarify the group’s purpose, SANH’s page posted this in its “Recent News” section:
This group is a parody of the group ‘support your soldiers in uniform!!!’
http://www.facebook.com/group.php?gid=11911667121&ref=shareThis group is intended to point out the absurdity of the many groups on facebook that portray all soldiers to be heroes and shower the armed forces with unconditional praise.
Putting on a soldiers uniform and becoming part of a murderous organisation does not make you a hero.
Supporters of the group generally agree that the wars that our armed forces are participating in at the present time and in recent years are unecessary and unjust. Therefore we don’t feel that we should be pressured into offering ‘support’ to people fighting and killing innocent people for causes that we don’t believe in.
We recognise that the government are mainly to blame but also think that members of the forces need to take responsiblity for their own actions in choosing to support these causes. Soldiers have free will and the opportunity to not sign/re-sign up if they feel they are being asked to participate in an unjust war, so they also deserve a proportion of the blame if they choose to stay.
We also find it amusing how so many of those who claim to ‘protect our freedoms of speech’ tell us to shut up, or be duffed up.
“Soldiers are not heroes. They can be heroes, they can act heroically, they can do heroic things – but the act of putting on a uniform and agreeing to put your conscience in a lockbox for the next so many years does not make your life more important than others, it does not make your opinions and insights more worthy of respect than others, it does not exempt you from moral judgment. It does not make you a hero.
And we should not fall prey to hero-worship.”
http://whoviating.blogspot.com/2008/06/heroics.htmlLet’s protest against these group protesting against the protests against the forces ffs!!!
THIS GROUP ISN’T A SOLDIER HATRED GROUP, JUST A GROUP AGAINST THE HERO WORSHIP OF SOLDIERS.
After checking out the “Support your soldiers in uniform!!” (SYSIU) group, I have to agree that it’s a close parody, even down to a quip about the font and color on the t-shirts to keep them “uniform.” The debates on this news piece, especially regarding the soldiers’ free-will, post-enlisting, are fully open.
After a great deal of time and review, I believe PTRS is mistaken in their goal, especially if they believe their own claim to be pro-freedom-of-speech. SANH’s latest claim to be a parody and not a “soldier hatred group” seems believable. Hopefully, this Facebook skirmish stays confined within the Facebook realm and avoids the judicial system, which is always my fear when it comes to matters of freedom–or suppression–of speech.
1 commentAnother 5 AM
I don’t want to sleep.
OK…that’s not entirely true. At 5 AM, I wish I could sleep, but my mind’s too active and, seemingly, uncontrollable: I think about shows, past/current relationships (intimate and platonic), work, mistakes, random scenarios (real and imagined), etc, etc, ad infinitum…
Maybe “life’s too complicated,” “I make life complicated,” or some other unoriginal thought. I want the reality of an Iron & Wine song:
One more drink tonight as your gray stallion rests
Where he lays in the reins
For all of the speed and the strength he gaveOne more kiss tonight from some tall stable girl
She’s like grace from the earth
When you’re all tuckered out and tameOne more tired thing the gray moon on the rise
When your want from the day
Makes you to curse in your sleep at nightOne more gift to bring we may well find you laid
Like your steed in his reins
Tangled too tight and too long to fight
The warmth of Sam Bean’s voice and the beautiful simplicity of his lyrics entices me into an idyllic life of horses and stable girls.
Realistically, I need to be able to afford the stable, horses, and tall, female employees. Besides, could I really leave the comfort, the connectivity, and the knowledge behind? I don’t require much, though I think I need more. Love, food, and horses might be all that’s needed.
…and sleep.
3 commentsAnother Great Post
This is just another brilliant post by The Undecided Blogger. As usual, it’s thoughtful, accessible, and pertinent to both the coming election and the education system.
Check it out.
No commentsI Thought His Name Was Lower Case
Some poems stick with me. I’ve thought of this poem by E. E. Cummings since high school: anyone lived in a pretty how town. Though I don’t entirely understand the imagery (you can take that statement from the school of thought that says the author has a distinct message to convey), I like the poem for the same reasons I love Mike Doughty; there’s a rhythm and a resonance in the word choice.
when by now and tree by leaf
she laughed his joy she cried his grief
bird by snow and stir by still
anyone’s any was all to hersomeones married their everyones
laughed their cryings and did their dance
(sleep wake hope and then)they
said their nevers they slept their dream
I enjoy it based on how it feels when I hear the words and not because of a deeper understanding. Why do other people enjoy it? Or why don’t they?
2 commentsA Philosopher Asks Buddha
No commentsA philosopher asked the Buddha: “Can you tell me the truth without word and without wordlessness?” The Buddha answered with silence. The philosopher thanked him for his loving kindness, thanks to which he had entered the Tao. After he left, Ananda asked what he had learned. “A good horse runs even when seeing only the shadow of the whip.”
~ Zen Flesh, Zen Bones
A Little Food For Though
For those of us still reeling from the Sarah Palin Interview, check this out.
No commentsThe Dark Knight
I just came back from seeing The Dark Knight. For some odd reason, I feel disturbed and slightly unsettled. I thought the movie was great, a real tribute to the comic, but something about the movie left me feeling . . . off.
Maybe it was the characters? The Joker felt almost too real, unexplained and the embodiment of anarchistic mayhem, but I realize he’s a caricature. They all are.
Next guess?
The lack of a happy ending? I lamented earlier this evening that I need happy endings. The hopeless romantic in me wants to see love . . . somewhere. This movie exhibited love as an offering to be sacrificed, but I don’t think that’s it.
I’ll have to think about it, but the more I do the less I want to.
No comments