Tag Archives: git

A dev’s MacBook from scratch

I’ve been a long time Apple user. I hate a lot about the company’s policy and how they treat their power users, but I love the tight integration between their software and hardware. Another thing to love is their migration tools. You buy new hardware, you click Restore from backup and you are done. Safari even opens up the tabs you had open on the old device. However recently, I’ve splurged on a new MacBook 12” and decided to set it up from scratch. For the fun of it. Here are some notes of how I’ve set it up for myself, for future reference and if someone is in a similar position.

Tips:

  • Don’t sign into iCloud during installation as that starts syncing everything to iCloud and you might not want that.
  • I moved over some files manually from a Time Machine external disk and they got “locked” i.e. I had to enter the admin password for any change to them. This is how I “unlocked” them: xattr -c -r FOLDER_WITH_LOCKED_ITEMS/ && chmod -RN FOLDER_WITH_LOCKED_ITEMS/

System configuration:

  • First off, update to the latest version of OS X, since every major update overwrites some system configuration and you don’t want to duplicate your work.
  • Turn on auto updates. Doh.
  • Go through all System preferences panes and see what works for you. Take your time to see what’s there, it pays off.
  • I disabled Location services, because I use VPNs a lot and then Location Services get totally confused.
  • Enable sending/receiving SMS and calls on OS X — a killer Apple feature for me.
  • Disabled Document Handoff because I don’t want all my docs in the cloud by default.
  • On a MacBook 12″ moving the Dock to the right makes the most sense in my eyes.
  • Set a nice “return for reward” message to be displayed on Locked screen. Something along the lines of “If you have found this laptop, please call me on MY NUMBER or send me an email to MY EMAIL and get a sweet reward! Thanks!”
  • Check Require an administrator password to access system-wide preferences. Doh.
  • Turn on FileVault and Firewall. Double-doh.
  • Firewall -> Advanced -> enable Stealth Mode. Though need to remember to turn it off when diagnosing network problems.

Finder preferences:

  • Show extensions.
  • When performing a search: Search the Current Folder, otherwise it searches the entire computer by default and almost kills Finder.
  • New Finder windows show: my home folder. I hate the “All My Files” default view. Absolutely hate it.

Various tools and apps:

  • Resilio Sync: fantastic app for sharing files among team members, based on bittorrent.
  • Slack: team communication, we use it religiously.
  • Crypho: secure team communication. I’m looking forward to the day when we can replace Slack with Crypho, so we have all communication secure, but as it is, Slack is just way more convenient for everyone to use.
  • LittleSnitch: allow/disable connections per app/port/protocol/address. Fantastic to prevent apps from contacting ads/tracking services and getting more insight into what goes on in the background.
  • Alfred: great productivity app, “replaces” Spotlight and then some!
  • Bartender: get that Menu Bar under control!
  • Flux: same as Redshift on Linux, adjusts screen colours for late night hacking sessions.
  • AppTrap: automatic cleanup of files that apps leave laying around after you delete them
  • iStat menus: to always be able to see what my system is doing with a glance.screen-shot-2016-10-05-at-20-44-24
  • Seashore: GIMP/Photoshop clone with a Mac-style UI. But seems an abandoned project, need to find a replacement …
  • Calibre: eBook management.
  • iBank: keeping my finances in check.
  • LibreOffice. And removed Apple’s Numbers & Pages.

Development environment:

  • Homebrew: the quintessential package manager for OS X.
  • Twitter: funny as it sounds, but Twitter is a great way to stay on top of latest patches/releases/news in tech.
  • Colloquy: a lot of Open Source still happens on IRC and this is how I keep in touch.
  • Chrome: been using it a few years now for browsing and development, but I want to switch back to Firefox soon. Extensions I cannot live without: BackStop, The Great Suspender, Send to Kindle, StayFocusd and Full Page Screen Capture.
  • Tunnelblick: the OS X OpenVPN client.
  • ExtFS for Mac: so I am able to mount ExtFS volumes (Linux drives, Raspberry PI SD cards, etc.)
  • pgAdmin3 and pgweb: admin interfaces for PostgreSQL, lately pgweb sees way more usage than pgAdmin3. Also sqlite browser for SQLite.
  • dotfiles: I keep a private git repo with all my “dotfiles” so history is tracked.
  • travis-cli & heroku-cli: working with Travis and Heroku from the comfort of the terminal window.
  • Vagrant: for simple virtualization needs, when I want to test out something without polluting my main environment.
  • Shush: a vital tool for any remote worker, to keep unwanted background noise from polluting teleconferencing.
  • Sublime Text: I’ve been a TextMate user for quite a while but I jumped ship when I saw how much faster ST is. That was years ago and I’m sticking with ST for now, got used to it and it works for me. I did migrate to ST3 recently though. The list of plugins I use:
    • GitGutter
    • SideBar Enhancements
    • Requirements Txt
    • Color Highlighter
    • CSS3
    • jQuery
    • SublimeLinter
    • SublimeLinter-annotations
    • SublimeLinter-pydocstyle (sudo pip2/3 install pydocstyle)
    • SublimeLinter-flake8 (sudo pip2/3 install flake8)
    • SublimeLinter-jshint (npm install -g jshint)
    • SublimeLinter-shellcheck (brew install shellcheck)
    • SublimeLinter-pyyaml (sudo pip3 install pyyaml)
    • SublimeLinter-json
    • BracketHighlighter
    • Jedi – Python Autocompletion
    • theme: SoDaReloaded Light.sublime-theme
    • pdb snippet: https://gist.github.com/phalt/72117041fbb7cf4c4697
    • starting ST from the current dir in console by typing subl -n .: https://www.sublimetext.com/docs/2/osx_command_line.html

Collective SVN project -> GitHub

More and more Plone projects are being migrated over to GitHub for various reasons. Here’s a quick guide on how to import your Collective SVN project into GitHub.

GitHub can directly import SVN projects only by specifying a URL to the repository. However, for some reason this does not work for Collective SVN repositories. The import screen keeps processing but nothing happens. You are left with the manual approach of migrating a Collective SVN repository to GitHub.

GitHub account

Naturally, you first need an account at GitHub. Go register if you don’t already have one!

Git repository

Next you need to create a git repository. Login to GitHub and go to your Dashboard. Follow the New Repository button in the right-hand portlet and fill in the required fields. Click Create Repository. Great, your git repository is now ready!

Instead of creating a new git repository in your own account, you can also consider creating one in the unofficial “Collective” GitHub account – an experiment by a few fellow Plonistas to recreate the Collective spirit on GitHub.

Authors

Before proceeding you need to compile a list of people that committed code to your project. Do that by inspecting output of svn log http://svn.plone.org/svn/collective/<your.project>. Create a file called authors.txt where you map all SVN committers to GitHub users:

zupo = Nejc Zupan <[email protected]>

The format of the mapping is svn_username = git_username <git_email>. You can also generate this list automatically.

Using plone.org’s author page usually gives good enough results for connecting SVN usernames with real people:

http://plone.org/author/<svn_username>

First commit revision

The Collective SVN repository is huge. As of this writing, it has over 240k commits. Running “git svn clone” over the whole history takes quite some time. To speed things up, write down the revision number of the first commit in your Collective SVN repository. Inspecting the oldest entry of svn log http://svn.plone.org/svn/collective/<your.project> will give you this number.

Import

There are many tools and approaches you one can use to perform migration from svn to git. This guide uses git-svn. While it has some limitations (branches and tags won’t be migrated) it does it’s job. All you need to do is run the following 4 commands:

$ git svn --authors-file=authors.txt clone -r<first_commit_revision>:HEAD -s \
http://svn.plone.org/svn/collective/<your.project> <your.project>
$ cd <your.project>
$ git remote add origin [email protected]:<your_git_username>/<your.project>.git
$ git push origin master

There, your project now happily lives inside a git repository on GitHub. Access it by pointing your browser to https://github.com/<your_git_username>/<your.project>.


Big thanks to Martijn Pieters of Jarn and Kai Lautaportti of HexagonIT for helping me out with my first steps using git and GitHub, you guys rock!

Useful links: