Git Cheat Sheet (Debian based)

Dec 17
2009

apt-get remove --purge gitk gitosis git-gui git-core
apt-get install mercurial

Projects’ Hosting

Dec 16
2009

Why Assembla free plan:

  • Subversion Hosting with Integrated Tickets
  • Trac and Subversion Hosting
  • Team Collaboration
  • Subversion Repository
  • Git with Integrated Tickets

P.S. If you are like me - spitting on GIT on a daily basis - Mercurial is included in the other plans.

How to sort a file by its columns

Jun 04
2009
# sort by user id
ruby -a -F: -ne 'puts $F.values_at(2, 0).join("\t")' '/etc/passwd' | sort -g
 
# sort by user home directory
ruby -a -F: -ne 'puts $F.values_at(5, 0).join("\t")' '/etc/passwd' | sort -g
 
# sort by username
ruby -a -F: -ne 'puts $F.values_at(0).join("\t")' '/etc/passwd' | sort -g

Getting Negative Number

Oct 28
2008
positive = 10.01
 
# the negative equivalent: -10.01
 
negative = positive - (positive * 2)
negative = positive * -1 # or
negative = positive / -1
negative = -positive # or 
negative = ---positive

Sorting an Array of Hashes with unknown keys

Jul 19
2008
AoH = [{"z"=>26}, {"g"=>7}, {"r"=>18}, {"a"=>1}, {"v"=>22}]
 
# sort by key
AoH.map{|e| e.to_a.flatten}.sort{|x,y| x[0] < => y[0]}
# sort by value
AoH.map{|e| e.to_a.flatten}.sort{|x,y| x[1] < => y[1]}

Enigma

Jul 09
2008

Here’s the mirror
Behind there is a screen
Turn around
On both ways you can get in
The experience of survival
Look around just people, can you hear their voice
Find the one who’ll guide you to the limits of your choice
The experience / of survival
Try to think about it …
That’s the chance to live your life and discover
Try to think about it
The experience of survival
The experience …
The experience of survival
The experience …

Google Chart API

Jun 30
2008

Charts for a map (in this example I’ve included Spain, France, Italy and Norway):






more about this API

Fun with String class methods

Jun 14
2008
class MyString < String
  # not really useful
  alias + concat
 
  # emulates Array '*' method
  def *(string)
    self.split('').inject('') do |s1,c|
      s1 + c + string
    end
  end
 
  # emulates Array '-' method
  def /(string)
    (self.split('') - string.split('')).to_s
  end
 
  # chars' delimiter
  def delimiter(string)
    self.*(string).sub /.$/, ''
  end
 
end
 
a = MyString.new("abcdef")
b = MyString.new("ABCDEF")
 
puts a * ':'
puts a / (b + "a")
puts a.delimiter(":")
 
#a:b:c:d:e:f:
#bcdef
#a:b:c:d:e:f

cheat sheets

May 29
2008

command-line cheat sheets


279 cheat sheets:


$cheat sheets

$cheat unix_text

One of Unix’s most useful features is its large number of text/data
manipulations programs. Some of the more propular include:

cat - concatenate and display files
cut - remove selected fields from each line of a file
sort - sort and collate lines
uniq - remove or report adjacent duplicate lines
awk - pattern scanning and processing language
sed - stream editor
tr - translate characters
diff - display line-by-line differences between pairs of text files
grep, egrep, fgrep - search a file for a string or regular expression
paste - join corresponding lines of several files, or subsequent lines of one
file
colrm - remove characters from specified columns within each line
expand, unexpand - expand TAB characters to SPACE characters, and vice versa

Geerd Wilders: Enough is enough

Mar 28
2008

Calendar

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Tags