A bunch of stuff

I’ve been quite busy but I’m still trying to learn a thing or two daily.

Termbox

Termbox-go is a go wrapper to work with the Termbox library which allows to make simple console-based applications. It’s quite neat and easy/straightforward to do. I’ve been learning a thing or two with it. And it has been fun thing to do during the weekend, I also used it as a joke for a couple of friends parodying the “hacking time” segment of the movie Kung Fury, you can see it in this gist

example 1433166472_2015-06-01-103331_374x453_scrot.png

You could probably make things way more useful than this, but doing useless stuff is sometimes both fun and educative.

Sinatra

I’ve started building a small ruby app to scratch an itch in my company. Mainly management of client feedback and such. I’m using Sinatra+Datamapper because I want to finish it quickly, later on I might port it to Go if I have the time, but Ruby is good enough for now. This has taught me how to better organize a Sinatra project (since I don’t want to cram all that functionality on a single module) and testing the framework actions.

Crypto

Cryptography course keeps being amazing, but I’m a little delayed with the course (which was to be expected). I’m not too confident to have enough time to take the final exam, but in the worst case scenario I might just take the second term course to reinforce my knowledge (and implementing all other crypto methods that are not part of the course homework). The last week homework consisted on integrity validation, which is a little less exciting than other algorithms but it was fun enough for me to do the assignment. But basically it involves generating a SHA256 sum of a file backwards progressively in blocks of 1024 bytes, I made use of the io.ReaderAt interface for this.

package sha256

import (
    "crypto/sha256"
    "io"

)

func HashBlock(block []byte) []byte {

    hash := sha256.New()
    hash.Reset()
    hash.Write(block)
    return hash.Sum(nil)
}

func HashFile(input io.ReaderAt, size int64) []byte {
    var current []byte = make([]byte, 1024)
    var previous []byte

    rest := size % 1024

    var last []byte = make([]byte, rest)
    _, err := input.ReadAt(last, size - rest)
    if err != nil {
        panic(err)
    }
    var offset int64 
    if rest != 0 {
        offset = size - rest - 1024 
        previous = make([]byte, 32)
        copy(previous, HashBlock(last))
    } else {
        offset = size - 1024    
    }


    for  offset >= 0 {
        _, err := input.ReadAt(current, offset)
        if err != nil {
            panic(err)
        }


        copy(previous, HashBlock(append(current, previous...)))

        offset -= 1024
    }

    return previous
}

Meetups

I’m a little bummed that there wasn’t any meetups of coding groups nearby, I find them extremely motivating to keep learning, perhaps I should make some sort of compendium of what I’ve learned these months and present it as a lightning talk, that might make it more interesting. But I can’t really decide which topic I like the most to talk about. Tough choices.

SWOT

This is a fun one, I’ve been introduced to SWOT Analysis by an episode of Silicon Valley by the infamous character Jared. I thaught it was silly at first but I gave a try to the method in a couple of situations and it comes in handy when having to take hard decisions. It’s funny how sometimes some completely unrelated tool heard by pure coincidence can prove itself useful at times. It seems to be meant to work on single “yes or no” kind of situations, I wonder if there are similar tools to help making decisions on several alternatives.

example 1433166684_SWOT.jpg SWOT in action (keep in mind that showing your SWOT session to any of the parties involved might end up in really awkward or life-threatening situations)

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket