Wednesday, February 17, 2016

Dealing With Hex In Ruby pt.2

Below are some common conversions I've needed in the past:

#Convert Hex number to Ascii:
> "\x41"
=> "A"

#Convert cat'd hex to ascii:
> 414142444534.to_s.split.pack("H*")
=> "AABDE4"

#Convert ascii "A" to Hex:
"A".unpack("H*")
=> ["41"]

#Convert ascii "A" to Decimal number
> "A".ord
=> 65

#Convert ascii 'asdf' to Decimal numbers
> 'asdf'.chars.map(&:ord)
=> [97, 115, 100, 102]
#or
> 'asdf'.chars.map {|x| x.ord}
=> [97, 115, 100, 102]

#Convert "AAAA" to \x41\x41\x41\x41
> puts "AAAA".unpack("H*")[0].chars.each_slice(2).map{ |a, b| "\\x#{a}#{b}" }.join
\x41\x41\x41\x41
=> nil
#or
> puts "ABCD".unpack('H*')[0].gsub(/(..)/,'\x\1')
\x41\x42\x43\x44
=> nil

Saturday, February 13, 2016

Hacker Hobbies

Hacker's tend to be very concentrated on their art. They spend a lot of time, nose down, in the grind and subsequently become some of the most knowledgable people in their areas of expertise. Unfortunately, sometimes spending too much time on one topic can lead to a lack of creativity, a lack of "big picture" thinking. If you're view is too narrow, you may miss the larger picture. Below is a list of hobbies that tend to prevail amongst the hacker community. Read through and see if any sound like they are up your alley. Who knows, you may even become a more rounded person :)

  • Electronics
  • Brewing (Wine/Beer/Mead/Liquor)
  • Cars
  • Small Engine Repair
  • Lockpicking
  • Ham Radio (About a thousand different things you can do with ham radio)
  • Drone Flying (Building/Racing/Video/Customizing)
  • Vaping
  • Cooking
  • Big Data Science
If you can think of any more, comment it below.