Posts Tagged ‘git’

2012w07

Sunday, February 19th, 2012

What I thought I’d do was I’d try some more tweaks, this one about categorization. Mostly because I think some of the neat things I’ve stumbled over in the past couple of weeks might not deserve their own heading. So I am revamping the headings:

Hacks

I thought this section would be about… not necessarily hacks, but if you would, the hacker mentality. Redefining a problem, is one such trait.

And building an eco-friendly house for around $5000 is defintively another.

Finally, Hacking Hacker News, which sounds like a rather fun project.

Tech

I’ve been meaning to learn wireshark, mostly because I could probably put it to pretty good use at work, and then I found pcap2msc which could probably be pretty useful for visualizing the collected data.

I also found a pretty useful site, Sleepyti.me which, given an average sleep cycle of 90 minutes, and user input when she wishes to wake up, calculates when the user should go to bed. Neat!

Commandline

I came across a very good explanation on how to use join.

I’ve also looked into how to increase trust in commits in git, namely by signing commits with your gpg key, and it turned out to be downright easy to accomplish.

Society

I guess that if we are completely ok with any potential ramifications of businesses keeping track of everything we buy, and speculating about what our purchases indicate, then it is completely ok to dispose of cash altogether. Personally it scares the willies out of me.

It’s funny how people seem to always confirm my concerns by abusing powers they shouldn’t have had in the first place…

I knew there was a I keep calling these guys the MAFIAA. Asshats…

While I understand this point and certainly agree to a certain degree, I maintain that if more people voted with their wallets, they’d soon run out of funds with which to buy new laws.

:wq

2012w06

Sunday, February 12th, 2012

Update: Ooops, I guess we gone incremented the year again… and no one thought to tell me :(

ACTA

It’s comforting to know that the people we elect to rule us at least know what they’re doing… Oh… wait…

git and branches

Last week, for the first time, I think I groked branches. The headline mentions git branches, and if they are different from other VCS’ branches, then last week I think I groked git branches :P

I’ve known about branching for quite a while, but never gotten past anything other than a rudimentary understanding.

I think I understood how mercurial does it (simply clone the repository, name the root directory of that clone to whatever you want to call that branch, and presto. (And yes, I am aware that mercurial has a branch command as well, so my understanding on that point is probably incorrect).

Either way, what finally gave me an “aha”-moment was this blogpost.

And while one the subject: Other uses of git. I am going to take a closer look at especially Prophet.

Links

AUTOMATE ALL THE THINGS

No but seriously, frakking do it. Automation ftw.

My Software Stack 2011 edition

Saturday, December 31st, 2011

I realize that I haven’t written my customary “software stack” post for this year yet. But hey, from where I’m sitting, I still have … 36 minutes to spare ;)

I’ll be using the same categories as last year; system, communications, web, development, office suite, server, organization, and entertainment.

System

The OS of choice is still Archlinux, my window manager is still wmii, my terminal emulator is rxvt-unicode, upgraded by also installing urxvt-tabbedex.

My shell is still bash, my cron daemon is still fcron, and my network manager is wicd.

To this configuration I’ve added the terminal multiplexer tmux, and have lately found out just how useful mc can be. Oh, and qmv from the renameutils package is now a given part of the stack.

Communications

Not much change here, Thunderbird for email, Pidgin for instant messaging, irssi for IRC.

Heybuddy has been replaced by identicurse as my micro-blogging (identi.ca) client. Heybuddy is very nice, but I can use identicurse from the commandline, and it has vim-like bindings.

For Pidgin I use OTR to encrypt conversations. For Thunderbird I use the enigmail addon along with GnuPG.

This means that Thunderbird still hasn’t been replaced by the “mutt-stack” (mutt, msmtp, offlineimap and mairix) and this is mostly due to me not having the energy to learn how to configure mutt.

I also considered trying to replace Pidgin with irssi and bitlbee but Pidgin + OTR works so well, and I have no idea about how well OTR works with bitlbee/irssi (well, actually, I’ve found irssi + OTR to be flaky at best.

Web

Not much changed here either, Firefox dominates, and I haven’t looked further into uzbl although that is still on the TODO list, for some day.

I do some times also use w3m, elinks, wget, curl and perl-libwww.

My Firefox is customized with NoScript, RequestPolicy, some other stuff, and Pentadactyl.

Privoxy is nowadays also part of the loadout, to filter out ads and other undesirable web “resources”.

Development

In this category there has actually been some changes:

  • gvim has been completely dropped
  • eclipse has been dropped, using vim instead
  • mercurial has been replaced by git

Thanks in no small part to my job, I have gotten more intimate knowledge of awk and expect, as well as beginning to learn Perl.

I still do some Python hacking, a whole lot of shell scripting, and for many of these hacks, SQLite is a faithful companion.

Doh! I completely forgot that I’ve been dabbling around with Erlang as well, and that mscgen has been immensely helpful in helping me visualize communication paths between various modules.

“Office suite”

I still use LaTeX for PDF creation (sorry hook, still haven’t gotten around to checking out ConTeXt), I haven’t really used sc at all, it was just too hard to learn the controls, and I had too few spreadsheets in need of creating. I use qalculate almost on a weekly basis, but for shell scripts I’ve started using bc instead.

A potential replacement for sc could be teapot, but again, I usually don’t create spreadsheets…

Server

Since I’ve dropped mercurial, and since the mercurial-server package suddenly stopped working after a system update, I couldn’t be bothered to fix it, and it is now dropped.

screen and irssi is of course always a winning combination.

nginx and uwsgi has not been used to any extent, I haven’t tried setting up a VPN service, but I have a couple of ideas for the coming year (mumble, some VPN service, some nginx + Python/Perl thingies, bitlbee) and maybe replace the Ubuntu installation with Debian.

Organization

I still use both vimwiki and vim outliner, and my Important Dates Notifier script.

Still no TaskJuggler, and I haven’t gotten much use out of abook.

remind has completely replaced when, while I haven’t gotten any use what so ever out of wyrd.

Entertainment

For consuming stuff I use evince (PDF), mplayer (video), while for music, moc has had to step down from the throne, to leave place for mpd and ncmpcpp.

eog along with gthumb (replacing geeqie) handles viewing images.

For manipulation/creation needs I use LaTeX, or possibly Scribus, ffmpeg, audacity, imagemagick, inkscape, and gimp.

Bonus: Security

I thought I’d add another category, security, since I finally have something worthwhile to report here.

I’ve begun encrypting selected parts of my hard drive (mostly my email directory) using EncFS, and I use my passtore script for password management.

And sometimes (this was mostly relevant for when debugging passtore after having begun actively using it) when I have a sensitive file which I for a session need to store on the hard drive, in clear text, I use quixand to create an encrypted directory with a session key only stored in RAM. So once the session has ended, there is little chance of retrieving the key and decrypting the encrypted directory.

Ending notes

That’s about it. Some new stuff, mostly old stuff, only a few things getting kicked off the list. My stack is pretty stable for now. I wonder what cool stuff I will find in 2012 :D

:wq

2011w29

Sunday, July 24th, 2011

vim and ctags

I’ve been meaning to look into ctags for a while, mostly because I’ve wanted some better way of being able to locate the definition or calls of a function, than popping up a new terminal and running grep. I know of :[l]grep and :[l]vimgrep and should really spend a day or two learning those as well, but ctags looks like it could be more useful to know immediately so for now I’ll focus on getting acquainted with these keybindings.

ctags itself is “exuberant ctags” and is found on sourceforge, if not available from your package manager. If you’re using vim you’ll also want to grab the ctags.vim script and just drop it into your ${HOME}/.vim/plugin/ directory.

In your source directory simply run $ ctags -R and you will have yourself a tags file for this directory and all subdirectories. Opening a file and calling :TlistOpen will give you a list of all the found definitions in the project. Unfortunately for me, I want all the newly created windows from a split to appear to the right or below, the original window, EXCEPT for this tag list window ;)

The solution to that came in a StackOverflow thread and is called Ctrl-W R

There are several good posts which helped me come to terms with ctags.

firefox and sorting downloads

For a while now *cough*since around 2006*cough* I have been using the absolutely asskicking add-on Download Sort for Firefox. You set up your rules for where files with a certain extension should go, and then you just start downloading files, and they all end up where they should.

Or so the theory goes. But let’s say that you get tired of having to move all your wallpapers downloaded from deviantart.com or wherever, to your wallpapers folder, from the generic images folder?

Then Download Sort is looking less good. There just isn’t a way to differentiate between an “image” jpg and a “wallpaper” jpg.
Sadly, the only add-on I’ve found which advertises the features I want, Automatic Save Folder, didn’t work for me at all. It might be my overly paranoid security settings screwing things up, but for some reason it just won’t remember any of the rules I set into place…

urxvt-tabbedex

I started playing with tabbed urxvt. I ultimately ended up installing urxvt-tabbedex and using that instead. The differences are small, but tabbedex doesn’t provide a “new” button (a new shell is spawned using Shift-Down, and tabbedex provides (the perhaps less useful) feature of renaming a tab (Shift-Up).

wmii

I have lived under the impression that I was using a really old wmii (even though the package I used was wmii-hg which should pull the latest version from the repository). The reason I was under the impression that this was old was that it never came any updates when I executed a $ yaourt -Sayu.

When I finally looked into it yesterday I finally realized that I was running on bleeding edge. The trick to wmii-hg, apparently, is that you need to manually re-install it to have it fetch the latest updates… What I took as project inactivity (and must thus be an old branch) was in fact not so.

As tagrules are severely broken in wmii-hg it hasn’t been fun using it (and colrules behaved very strange, but strange in a way I have now come to appreciate… go figure) but there were always issues with the wmii package in the repository, most having to do with an insane amount of flickering when creating a new terminal, or moving one about etc.

The flickering parts seems to have been solved, it might have had something to do with my transparent terminals and not a problem with wmii, I don’t know, but now it works.

Thanks goes out to pesa for single-handedly seeking out and vanquishing my final annoyance of wmii 3.9.2: that every now and then it would start spawning more than one terminal when I issued a command to get one.

When I was reloading the configuration, the old process remained, and with it, the listeners for keyboard commands… like starting a new terminal…

mercurial-server

I’ve been running the mercurial-server package on my server to provide me with easy access to (mercurial) repositories. This week, for some reason, it started failing.

I had updated mercurial from 1.3 to 1.9 and my first thought was that this had broken mercurial-server somehow, but after reverting the package, the problem came back.

Not immediately, mind you, which makes this whole thing even stranger.

But this has just provided me with the right amount of kick in the ass to get on my way and convert from mercurial to git, so all in all perhaps not a bad thing?

Links

Why I’m not going near spotify: It sums up pretty well my own feelings about Spotify…

In certain (rather specific) contexts, I even despise Spotify users, and here’s why: Imagine that you are sitting on a train, and you will be doing so for the next seven hours or so. The train has “internet”, via one 3G modem.

Now picture ten other passengers ALSO going online, their objective being to listen to Spotify. Can haz moar bandwifs plz? kthxbai

:wq

2011w27

Sunday, July 10th, 2011

Imagemagick hackery

This post outlines how to create an image containing text, using imagemagick. The comment made by Severin improved upon the original snippet by cropping the image to just fit around the text.

One could use this in a script if you just set the following variables: width, height, fontsize, text and filename. I could have added another variable for font, but that would have made the example code below less informative.

convert -size ${width?}x${height?} xc:transparent -font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf -fill black -pointsize ${fontsize?} -draw "text 0,${fontsize?} '${text?}'" -trim +repage ${filename?}.png

LaTeX and variables

One of the neatest things about LaTeX (except for the automagic table of contents generation, ease of use when it comes to references, and never having to worry much about typesetting) is that it really is a markup language. A markup language where you can define your own “macros” (commands as they are called in LaTeX). And these commands can be just as simple or complex as you have the skill to make them.

So for instance, if you are writing something in LaTeX, and you find that you have to write the same thing over and over again, you could define a new command which prints that for you wherever you call the command (this of course relies on that what you are writing many times is longer than the name you give your command, otherwise it wouldn’t make much sense. Unless of course this something you are repeating, may be subject to change later, and you don’t look forward to doing a search / replace across the entirety of the document(s).

I remember that our group used this during a semester at ITU, but then I “rediscovered” it this Monday as I embarked on a small writing project, being unsure if I liked the names I’d given my characters.

So now I have a “characters.tex” file, which just defines a couple of commands. These commands, in turn, do little more than return the name I have currently given the character. characters.tex is then imported into the main file (“novel.tex“) and whenever I need to call a character by name, I just use the command I defined for that character.

This question over at Stackoverflow.com helped me with an answer:

\newcommand{\protagonist1}{Tony}

I.e. We call the command \newcommand which takes two arguments, whereof the first is the name of the new command (in this case \protagonist1) and a command body, what the new command should do, which, in this case simply is to output the string “Tony”.

Ok, protagonist1 sounds kindof silly, and perhaps I should have named the command nightclubOwnerFname instead, but that would have been a fingerfull to type.

What you take away from all this is that if I ever decide to rename Tony to… iunno, Mark? I will only have to change it in one place, the characters.tex file.

To include a file in LaTeX you use:

\input{characters}

Why the “.tex” from “characters.tex” should be omitted in the input command I have no idea about, but that’s how I learnt it, and it works. One day I should really sit down and figure that one out.

Finally, to use the command inside your text you just write your stuff, but instead of writing the name you call the command:

She looked at \protagonist1{} in disbelief.

That’s pretty much all there is to it. Ain’t LaTeX neat?

Creating diffs in git

I started looking into fugitive but hit a brick wall smack dab in the beginning of the adventure as I’m running Arch, and its version of git was just slightly newer than that of p4bl0.

Once I got fugitive running, I wanted to get it to handle markdown (i.e. parse the markdown marked up as a part of the process of generating the published html), which had some unintended consequences for the <title> tag (i.e. markdown had already parsed the first line in the file, which is used as the post title) and this resulted in <title><p>my post title here</p></title>… that ain’t so good ;)

The upside to it was that I got to do a little digging around in code (which I need to get better at anyway) and I ended up solving that little problem (but that introduced a bug (yes, I suck, should’ve tested more first) but I have submitted another patch which should undo all my stupidity and make it right. This time I have done more testing ;))

BUT, it also meant that I needed to generate a diff that p4bl0 could use to patch fugitive. This blog post gave me all I needed to know, i.e.:

$ git diff --no-prefix > patchfile

Automatically mounting removable media in Arch

Although it can be reckless to automount stuff (because you never know where that USB stick has been ;)) it can be nice (comfortable) to have it all done for you, and that’s where autofs can help you.

Links

http://make-everything-ok.com/

Update: fixed silly typo, thank you mina86

2011w23

Sunday, June 12th, 2011

myConf

This is a technology demonstrator of the FSCONS myConf concept that doesn’t rely on any server-side programming.

It also became my first project under git versioning.

myConf is a concept we’ve (FSCONS) been thinking about implementing since, IIRC, 2009.

Basically it should allow a participant to tailor a personalized conference schedule, instead of having to mark it up in a dead-tree version.

Or so is at least my understanding of the myConf concept.

In short it is a Javascript (jQuery) / JSON-powered site, from which I have now learnt two things:

  • It is as important (if not more so actually) to have a good JSON structure as it is to have a good database design, otherwise it WILL come back and bite you, hard
  • It is actually quite fascinating what one can do with Javascript (at least when a library is used so that you don’t need to even think about platform irregularities)

Expect a public release shortly.

vim foldsearch plugin

I was editing my sudoers file (I still haven’t gotten myself off sudo) and started wondering if there perchance wasn’t a way in vim to hide lines according to some pattern.

The default archlinux sudoers file is full of comments, to the point that it is almost hard to see the uncommented lines.

:g/pattern and :v/pattern only takes you so far, i.e. it shows you the lines, but immediately disappears when trying to edit or move or anything except just looking at it.

Luckily for me other people had already asked the same question, and yet other people had answered it.

Which lead me to the vim foldsearch plugin. Best of all, it is easy to use.

Search for something, i.e.:

/my pattern here

and then use <Leader>fs (I have mapped <Leader> to \ in my config, so for me that would be \fs) and voilà, all the lines not matching the search are folded away.

renameutils

I am sure I have already written about renameutils, or more likely about qmv, but it is worth repeating. qmv rocks!

wallpaper-switcher.sh

wmii is my window-manager, although I am probably running version 3.6 or something (i.e. not 3.9) so this might not be usable for people other than wmii 3.6 users.

Anyway, last Friday I got the idea to write a little script to switch wallpapers for me. Today I sat down and hacked it together:

#!/bin/bash
 
tmpList="$(ls -l ${HOME}/wallpapers/*.jpg | awk '{ print $NF }')"
tmpList=($tmpList)
 
randomWallpaper="${tmpList[$(($RANDOM % ${#tmpList[@]}))]}"
 
ln -fs "$randomWallpaper" "${HOME}/wallpaper.jpg"
exit 0

Links

shunit2 Unit-testing for (Bash) shell scripts, this is so cool :D
Akka for a simple way of writing concurrent applications in Java
Protolol jokes for nerds

2011w22

Sunday, June 5th, 2011

SSH tunnelling

This Friday I finally got a valid reason to dig into how one sets up an SSH tunnel between two machines. The reason was that I was sitting at the new FFKP office lulzing about with razor, and found myself needing to test some PHP I had been working on.

So I was not at home, I am not stuffing Apache and PHP and MySQL onto my netbook just to do web dev stuff, so I needed contact with my “server” back home.

The slight problem being that since it is for development use only, I don’t expose its Apache to the Internet, only to the local network. SSH is another matter altogether.

So I thought that it shouldn’t be impossible to set up what I wanted, i.e. from my netbook, type in localhost:8080 (or whatever port number floats your boat) and be routed through the tunnel to the server.

It turns out there was this really neat write up on how to do it, already available, and even better, it was really simple:

ssh -f <user>@<remote-host> -L <local-port>:<remote-host>:<remote-port> -N

-f makes it a background process, -L tells SSH we want a tunnel, -N tells SSH that we aren’t trying to execute a command.

This is something I might even begin to remember :)

wmfs

wmfs, or window manager from scratch, seems like an awfully nice little tiling window manager.

Unfortunately I haven’t gotten the time this weekend to play with it, but perhaps a little later today?

I was warned on diaspora that there is a pretty huge-ish performance-related bug in the code right now, and since I haven’t tested it yet I can’t make any recommendations, but from the very superficial (and that will hopefully soon change) observation of the documentation, it seems like it could be a wmii-replacer.

Links

As I am attempting to learn git, I soon came to the conclusion that the best way to learn it would be to use it.

After all, the basics are not extremely different from mercurial, and while most of my projects remain single-person-projects, the basics are more than enough for me.

So I hereby solemnly swear that the next little project I start, whatever it may be, will be versioned using git instead of mercurial.

My foray into the git world also meant that I started looking at the two largest git hosting solutions (both of them free as in beer, and one free as in freedom, github and gitorious.

In doing so, I ran through the list of hosted projects, and there is so much cool stuff out there to test, and try, and learn, and play with… so many things, so little time.

  • z – jump around, which studies your usage of the various directories on your machine, learns, and then makes it easy to jump to “popular” directories easily
  • yajl, Yet Another JSON Library, and I likes me sum JSON
  • Underscore.js, a javascript “utility-belt” library
  • wormhole a jQuery plugin, which for most parts would probably be more fun than useful, but it seems to have been initially written to scratch an itch
  • Backbone.js, which I had already read about here and been wanting to play with it ever since
  • Microjs, a site for finding the javascript framework you need, in order to do what you want
  • Raphaël, a javascript library for working with SVG
  • TMS, a Temporary Mail Server, written in Python, this just must be useful for testing and debugging mail-stuff
  • tablib, another Python module, this one for parsing and converting tabular datasets between various formats, (i.e. csv, html, json, ods, xls(x), yaml)
  • twotwodo, a personal 2do list in the browser, using jQuery (javscript) for logic, and cookies for storage (so it is local to the machine, with no shared storage back-end, which can be good sometimes
  • protovis, nice javascript visualization toolkit

Two other links I find worth mentioning are:

FamFamFam has a rather nice-looking icon set (Silk), licensed using CC By 2.5 or 3.0, which I might finally get to use in a project of mine (haven’t really gotten a chance since it was a long time since I did any serious web programming.)

Finally, a blog which has helped me greatly in understanding various things is BetterExplained which has now released something new which they call aha.betterexplained.com, and I will follow this with great interest.

Revelation of the week

The one real “aha” moment this week was Friday afternoon, when Grégoire showed me that it was possible to add people from other diaspora seeds by searching for their <username>@<other-seed>.
That was good news since I was rather bummed out about razor and greg had set up shop at diasp.org leaving me with relatively few contacts on “my” seed.

Other than that, to be honest, this week has been pretty boring. I did get a whole lot done in timetrack yesterday, and found a deeper love for grep‘s -A flag, and I have been doing some serious thinking about writing my own “makefile blogging”-thingy.

Friday night right before falling asleep I got the idea to write a little script which would pick a wallpaper at random and set that as the active wallpaper at startup. Since I use wmii, and wmii uses xloadimage, given a path, I could simply put all my wallpapers in a directory and have the script symlink one at random on start up.