Erik Zaadi

Tales of the CI guy

Solarized Color Scheme for Octopress

| Comments

Created a solarized theme for octopress.

Inspired by Ethan Schoonover’s own homepage.

The source is as always on github.

To add this to your own Octopress instance :

Install Solarized Theme
1
2
3
cd /my/awesome/octopress/dir
git clone http://github.com/erikzaadi/solarized-octopress-theme .themes/solarized
rake install["solarized"]

zsh users : run

Zsh syntax
1
rake install\['solarized'\]

instead of the last command

Customize

To toggle between light and dark mode, edit sass/custom/_colors.scss and change $sol and $solarized:

1
2
$sol : light; // light or dark -  Recommended: set $solarized  to the opposite of this
$solarized : dark; // code syntax highlighting theme

Screenshots

Dark

Light

Auto Installing Vundle From Your Vimrc

| Comments

You should be using vundle

Vundle is a vim plugin manager, ala pathogen.

Vundle allows you to specify in your vimrc what vim plugins you wish to load, and it’ll automatically download (git clone if possible) and enable vim plugins.

Vundle can get a name of a plugin as it appears in the vim plugin directory, a github “:user/:repo” style string, and even a full git url.

vimrc
1
2
3
Bundle 'Syntastic' "uber awesome syntax and errors highlighter
Bundle 'altercation/vim-colors-solarized' "T-H-E colorscheme
Bundle 'https://github.com/tpope/vim-fugitive' "So awesome, it should be illegal 

Vundle also updates your vim plugins with a simple command :

Update all your bundles
1
:BundleInstall!

Vundle is awesome, it saves a lot of the manual work needed in pathogen.

Even more if your installing your vim plugins manually, oy vei.

However, there’s always the fuss of getting it installed on a fresh machine. Adding these lines to your .vimrc, fixes that :

vimrc with vundle-o-matic Entire .vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
" Setting up Vundle - the vim plugin bundler
    let iCanHazVundle=1
    let vundle_readme=expand('~/.vim/bundle/vundle/README.md')
    if !filereadable(vundle_readme)
        echo "Installing Vundle.."
        echo ""
        silent !mkdir -p ~/.vim/bundle
        silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
        let iCanHazVundle=0
    endif
    set rtp+=~/.vim/bundle/vundle/
    call vundle#rc()
    Bundle 'gmarik/vundle'
    "Add your bundles here
    Bundle 'Syntastic' "uber awesome syntax and errors highlighter
    Bundle 'altercation/vim-colors-solarized' "T-H-E colorscheme
    Bundle 'https://github.com/tpope/vim-fugitive' "So awesome, it should be illegal 
    "...All your other bundles...
    if iCanHazVundle == 0
        echo "Installing Bundles, please ignore key map error messages"
        echo ""
        :BundleInstall
    endif
" Setting up Vundle - the vim plugin bundler end

This will clone vundle and activate it, and install all your bundles (if vundle is not installed).

Disclaimer : Works on my machine ;)

This should work on any *nix machine, although windows 7 should cope with it too (not tested lately)

Enjoy!

Blog Now Hosted on Amazon S3

| Comments

After migrating my blog from wp to octopress (see previous post), I started thinking that it might be a waste using a (shared) hosting account just to serve static files. Since I use Amazon Web Services a lot, I thought I might give Amazon S3 a shot.

There’s a zillion posts out there of how to make a static site in S3, including for octopress sites, so I won’t bother you with repeating the steps here (see the links in the end of the post).

There are two pitfalls worth repeating though:

  1. DNS

    You can’t point your bare domain to your S3 bucket, as it requires a CNAME record and not a A record.

    This is mainly due to Amazons’ dynamic IPs (which is a good thing).

    The only way to point to the static S3 site is with a subdomain, typically with ‘www’.

    You might have a domain registrar which can mask the request to the bare domain to the ‘www’ subdomain, however I was not so lucky :(

    I did however find a free service called wwwizer, which redirects your bare domain requests to the ‘www’ subdomain.

    It’s a bit akward that this occurs on the http level and not at the DNS, but hey, it’s free and it works.

  2. Syncing your site to S3

    There are tons of ways you can sync the generated static site to S3.

    1. There are two uploaders (regular and java app) at the aws console
    2. Several browser extensions and desktop apps
    3. A gem called jekyll-s3 which uploads the generated ‘_site’ folder.

      This works great, but is hardcoded to use the ‘_site’ folder, and you need to tweak octopress a bit to change it from ‘public’.

      The annoying thing I saw was that it’s uploading assets that haven’t changed.

      I forked the project and started hacking away on a option to pass the folder name to upload to s3.

    4. A cli based client called s3cmd available via homebrew, apt etc.

      This is an awesome client, which you can use to sync the generated site, uploading only the changed content.

      I actually forked octopress and submitted a pull request with a deployment step using s3cmd, it was actually only after I submitted the pull request that I saw several other identical pull requests….

Links with explanations of how to host a static site on s3

http://thechrisoshow.com/2011/06/05/how-to-host-a-static-website-on-s3 http://aws.typepad.com/aws/2011/02/host-your-static-website-on-amazon-s3.html http://www.ianwootten.co.uk/2011/09/09/hosting-an-octopress-blog-on-amazon-s3

Mv {word,octo}press

| Comments

After my wordpress blog was hacked twice, and I got a warning from google that I host malware (!), I decided that enough is enough, time to ditch Wordpress and hope never to see php code again.

I managed to resist the urge to roll my own blog engine (haven’t we all been there?), and decided to use octopress.

After being victorious over ruby and rvm who thought it’d be hilarious to make me go crazy while making earthquake work, I thought I might give octopress a shot.

It took me one late night hack to get everything up and running.

I used exitWP’s script to generate markdown posts. Then I did some sed magic to add

Enabling comments
1
comments: true

to the yaml head of all post files.

Since I’ve got all my images hardcoded to wp-content (for now), I simply added that folder to the source folder.

I imported all my comments to disqus using the same WXR export file I used to migrate with exitWP, and the comments where available after a few hours.

I changed the permalinks format a bit to keep the same url scheme as wordpress for the posts, and changed the category scheme to fit as well:

_config.yml
1
2
3
4
5
permalink: /:year/:month/:day/:title/
#permalink: /blog/:year/:month/:day/:title/
...
category_dir: category
category_title_prefix: "Category: "

For a more thourough migration guide try Pavan Podila or Vito Botta.

I still have some more work cleaning up the posts, adding correct (and awesome) code highlighting, redo the theme etc.

But hey, that’s exactly why I like octopress, so much enjoyable stuff to hack on :)

Startup Weekend Haifa (2011)

| Comments

Last week, a Startup Weekend event took place in Haifa.

Being somewhat of an addict to Startup Weekend, I attended.

Although the location was a bit smaller and less equipped than the previous Startup Weekends in Tel-Aviv (Yaffo), the organizers worked hard to make it a fun and enjoyable experience.

I pitched an idea there that didn’t get enough votes unfortunately, although I had a lot of positive response from people.

I joined a team called VideoChef, with some really great people.

You can see the presentation here  and the final site (although there’s no live video now of course) here.

It was a lot of fun as usual, however I really got the feeling that there weren’t enough hackers at the event.

Surprisingly enough, there were plenty talented designers there, which at previous events was more rare.

There were PLENTY Business Devs / Marketeers there, even more than enough..

I had a interesting conversation with Microsoft rep at the event, and I asked a lot of questions about Windows 7 Phone, where most of the answers where :

No that’s still not possible, but soon it’ll be available

I got a peculiar answer when I asked if Microsoft takes interest in Mono, and if so, do they encourage usage of Mono :

I’m prevented from answering that

Of course that’s just one specific Microsoft rep, and not necessarily the official response..

Anyhuze, waiting for the next Startup Weekend at Tel-Aviv or even better, Jerusalem..

Connecting Jenkins to Self Signed Certificated Servers

| Comments

I’ve recently needed to connect our Jenkins CI server to several internal servers such as Jira and IRC (Fun post coming soon on Jenkins@IRC..).

The problem with these servers are that their SSL certificates are selfsigned. This causes Jenkins to fail when connecting to the servers with the following error (Which you can see in the Jenkins log):

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

To solve the problem, instead of going through Java keysigning hell, download JavaSSL.zip, extract the files and open a command prompt or shell to the extracted folder.

Then run :

java InstallCert yourServerOrIP

By default, it’ll try port 443, however if you need a custom port, say 8888 run:

java InstallCert yourServerOrIP:8888

When prompted, accept the certificate. This will create a file called ‘jssecacerts’ in the same directory. Notice that the command will list a alias for your server, we’ll use that later.

Now copy / symlink the ‘jssecacerts’ into $JAVA_HOME/jre/lib/security. If you can’t find your JAVA_HOME dir, try ls -l /usr/bin/java on *nix, or the installed java directory in your program files on Windows. Furthermore, copy / symlink the same file to your home directory and rename to “.keystore”

To test that it works, run:

keytool -list

When prompted for a password, enter “changeit”

You should now be able to see the certificate you imported. To narrow down the keytool search, you can run

keytool -list -alias yourServerAlias

where alias is the name you should have seen in the end of the InstallCert command.

To test that the connection works, we’ll run:

java SSLPoke yourServerOrIP

or if you need a custom port, for example 8888:

java SSLPoke yourServerOrIP 8888

Hopefully you’ll get a connection succeded, if so, restart Jenkins, and you should be able to connect to the self signed certificated server.

References : InstallCert SSLPoke

The Small Things

| Comments

Lately I’ve been going deeper and deeper down the nix rabbit hole at my new work.

The deeper I go, the more I undestand what a nix n00b I am. I’ve had so many OMG/AHA! moments, and it reminds me a bit of the period I (re)discovered the Mac, and when my journey of the open source world began.

Here’s a small example that’ll make anyone with nix experience chuckle, since it’s so basic:

When in the middle of a long process such as a download, pressing ctrl+Z, the download will continue in another process [UPDATE] ctrl+z stops the process, if you want it to continue in background u need to run ’bg’, freeing the prompt. Enter the command ‘fg’, and POFF, you’re back to the download.

Geekalicious!

Another thing I’m really enjoying learning is Python. It’s with its perks of course, but having a REPL to debug and hack around in is awesome!

Exiting times indeed!

Thanks @theyonibomber for the correct answer.