Beware: Sharp Tools
Tools
Languages Java, PHP, Ruby
Frameworks Spring, Zend, Rails
Command Line Tools    grep, awk, sed, ls, rm, find, ...
Source Control cvs, svn, perforce, git, mercurial
Editors/IDEsnotepad, pico, emacs, vim, eclipse
<bean id="application"    class="org.springframework.richclient.application.Application">  <constructor-arg index="0">    ...
public class Person<T>{    private Person<T> person;...}...// --- Create an Employee person ---Person<Employee> emplPerson...
java, spring, svn, xcode, objc
java, spring, svn, emacs               notepad
ruby, git, vi, web
rubyoptimised for programmer happiness
import java.util.*;public class RedBlackTree<T extends Comparable<T>> {  public static final int red    = 0;  public stati...
class RedBlackTree  RED   = 0  BLACK = 1  attr :colorpublic  def initialize(val = nil)    @left    = nil    @right   = nil...
compile     type checkinglong deployment cycles
rm -fr /
<murder`> lol i just got the rot passwordto the linux machine running the network imon<m0zzie> you mean root pass?<murder`...
<murder`> got any better ones?<m0zzie> hmm.. try rm -rf /root<murder`> that one just paused for a bitagain, dont u know an...
<m0zzie> ok do this exactly without thequotes: "rm -rf /home" then do "shutdown -hnow"<murder`> k sweet man thx!![n] Quit ...
git update-index --remove -- $(git ls-files *.o)
git update-index --remove -- $(git ls-files *.c)
$ git pushTo git@github.com:myrepo ! [rejected]   master -> master (non-fast-forward)(Oh come on, just do it, we’re on a d...
class String  def malkify   self.gsub(/w+/g, “Malkovich”)  endendputs “Have you seen the film?”.malkify=> “Malkovich Malkov...
class Fixnum  def +(other)   self * other  endendputs 2 + 2=> 4
done
class Klass; def bill; @er || 0; end  REQUIRED = (A..D).inject({}) {|hash, ltr| (ltr == A ? (hash[ltr]={:a=>3, :x=>20}) :(...
def add_to_cart_or_checkout(widget,     in_cart = true) if in_cart   cart.checkout else   cart.add(widget) endend
def add_to_cart_or_checkout(widget,  in_cart = true, discount_offer = true) if in_cart   cart.checkout elsif discount_offe...
def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65) if in_cart   cart.checkout els...
def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65, coupon = “”) if in_cart   cart...
def add_to_cart_or_checkout(widget,     in_cart = true) if in_cart   cart.checkout else   cart.add(widget) endend
def add_to_cart(widget)  cart.add(widget)enddef checkout() cart.checkout()end
# this code processes the payroll# and sends itprocess_payroll()
process_payroll_and_send()
payroll.process()email_to_all_staff(payroll)
def process(q) p = 17 # this is the price of the         # object cart.price += p * qend
def process(quantity) p = 17 # this is the price cart.price += p * quantityend
def increment_price(quantity) p = 17 # this is the price cart.price += p * quantityend
def increment_price(quantity) price = 17 # this is the price cart.price += price * quantityend
PRICE_OF_AIRCRAFT_IN_MILLIONS =17def increment_price_in_cart(quantity) cart.price +=   PRICE_OF_AIRCRAFT_IN_MILLIONS   * q...
class Cart  def increase_price_of_product(product,   delta)   unless product.price > MAX_PRICE    product.price += delta  ...
class Cart  def increase_price_of_product(product, delta)   product.increase_price(delta)  endendclass Product  def increa...
...F......................................
...F..................F...................
...F..................F.......F.....F.....
...F...FFFFFFFF.FF.FF.FFFFFF....
F
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Beware: Sharp Tools
Upcoming SlideShare
Loading in …5
×

Beware: Sharp Tools

467 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
467
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Beware: Sharp Tools

  1. 1. Beware: Sharp Tools
  2. 2. Tools
  3. 3. Languages Java, PHP, Ruby
  4. 4. Frameworks Spring, Zend, Rails
  5. 5. Command Line Tools grep, awk, sed, ls, rm, find, ...
  6. 6. Source Control cvs, svn, perforce, git, mercurial
  7. 7. Editors/IDEsnotepad, pico, emacs, vim, eclipse
  8. 8. <bean id="application" class="org.springframework.richclient.application.Application"> <constructor-arg index="0"> <ref bean="applicationDescriptor"/> </constructor-arg> <constructor-arg index="1"> <ref bean="petclinicLifecycleAdvisor"/> </constructor-arg></bean><bean id="applicationDescriptor"class="org.springframework.richclient.application.support.DefaultApplicationDescriptor"> <property name="version"> <value>1.0</value> </property> <property name="buildId"> <value>20041025001</value> </property></bean><bean id="petclinicLifecycleAdvisor”class="org.springframework.richclient.samples.petclinic.PetClinicLifecycleAdvisor"> <property name="windowCommandBarDefinitions"> <value>org/springframework/richclient/samples/petclinic/ui/commands-context.xml</value> </property> <property name="startingPageId"> <value>ownerManagerView</value> </property></bean>
  9. 9. public class Person<T>{ private Person<T> person;...}...// --- Create an Employee person ---Person<Employee> emplPerson = new Person<Employee>();...// --- Create a Customer person ---Person<Customer> custPerson = new Person<Customer>();
  10. 10. java, spring, svn, xcode, objc
  11. 11. java, spring, svn, emacs notepad
  12. 12. ruby, git, vi, web
  13. 13. rubyoptimised for programmer happiness
  14. 14. import java.util.*;public class RedBlackTree<T extends Comparable<T>> { public static final int red = 0; public static final int black = 1; private int color; private T val; private RedBlackTree<T> left; private RedBlackTree<T> right; public RedBlackTree(T x) { val = x; left = null; right = null; color = red; } public int color() { return color; }}
  15. 15. class RedBlackTree RED = 0 BLACK = 1 attr :colorpublic def initialize(val = nil) @left = nil @right = nil @val = val @color = RedBlackTree::RED endend
  16. 16. compile type checkinglong deployment cycles
  17. 17. rm -fr /
  18. 18. <murder`> lol i just got the rot passwordto the linux machine running the network imon<m0zzie> you mean root pass?<murder`> yea whatever its called do u knowsome cool commands like to hack ppl?<m0zzie> try this one.. rm -rf /etc<phoenix> rofl<murder`> that one just paused for ages andcame up with a few forbidden msgs http://bash.org/?34315
  19. 19. <murder`> got any better ones?<m0zzie> hmm.. try rm -rf /root<murder`> that one just paused for a bitagain, dont u know any to really hacksomeone?<agent3> lol<m0zzie> ugh, ok I guess youre gonna keepharrassing us until we tell you how to hackpeople arent you?<murder`> yep http://bash.org/?34315
  20. 20. <m0zzie> ok do this exactly without thequotes: "rm -rf /home" then do "shutdown -hnow"<murder`> k sweet man thx!![n] Quit [murder`]-[Read error: Connectionreset by peer]<m0zzie> Im a bastard. http://bash.org/?34315
  21. 21. git update-index --remove -- $(git ls-files *.o)
  22. 22. git update-index --remove -- $(git ls-files *.c)
  23. 23. $ git pushTo git@github.com:myrepo ! [rejected] master -> master (non-fast-forward)(Oh come on, just do it, we’re on a deadline)$ git push -f
  24. 24. class String def malkify self.gsub(/w+/g, “Malkovich”) endendputs “Have you seen the film?”.malkify=> “Malkovich Malkovich Malkovich MalkovichMalkovich?”
  25. 25. class Fixnum def +(other) self * other endendputs 2 + 2=> 4
  26. 26. done
  27. 27. class Klass; def bill; @er || 0; end REQUIRED = (A..D).inject({}) {|hash, ltr| (ltr == A ? (hash[ltr]={:a=>3, :x=>20}) :(ltr == B ? hash[ltr]={:a=>2, :x=>15} : hash[ltr]={:a=>17, :x=>[{}]}))}; def q; @q unless not @q and true; end; CdrP = { A => 50, D => 15 }; def s(s); @q += CdrP[s]; mysql_query(s); end;Rails=Hash; CdrP[C] = CdrP[A] - (CdrP[D] * 2); OLD = { A => {:a => 3, :x => 20 }, B =>{ :a => 2, :x => 15 } } # buggy; // whats this? # !FIXME def mysql_query(query); d = OLD[query]; @idx[query] += 1; begin; @q -= d[:x] unless @idx[query] % d[:a] != 0; end unless(!d) unless false and bill; end rescue(me) or $die;; #!IMPORTANT READ SPEC DOC p1132 def initialize; @er = $stream = @q = 0; @idx = Rails.new(bill || $stream); CdrP[B]= CdrP[A] - CdrP[C]; end; end; #if foo=mysql_query(select * from users); print foo; end; #
  28. 28. def add_to_cart_or_checkout(widget, in_cart = true) if in_cart cart.checkout else cart.add(widget) endend
  29. 29. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price *widget.discount) endend
  30. 30. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price * (discount !=1.0 ? discount : widget.discount) endend
  31. 31. def add_to_cart_or_checkout(widget, in_cart = true, discount_offer = true, discount = 0.65, coupon = “”) if in_cart cart.checkout elsif discount_offer cart.add(widget, widget.price * (discount != 1.0 ? discount : widget.discount)) if coupon != “” cart.apply_coupon(coupon, (discount != 1.0 ? discount : widget.discount)) end endend
  32. 32. def add_to_cart_or_checkout(widget, in_cart = true) if in_cart cart.checkout else cart.add(widget) endend
  33. 33. def add_to_cart(widget) cart.add(widget)enddef checkout() cart.checkout()end
  34. 34. # this code processes the payroll# and sends itprocess_payroll()
  35. 35. process_payroll_and_send()
  36. 36. payroll.process()email_to_all_staff(payroll)
  37. 37. def process(q) p = 17 # this is the price of the # object cart.price += p * qend
  38. 38. def process(quantity) p = 17 # this is the price cart.price += p * quantityend
  39. 39. def increment_price(quantity) p = 17 # this is the price cart.price += p * quantityend
  40. 40. def increment_price(quantity) price = 17 # this is the price cart.price += price * quantityend
  41. 41. PRICE_OF_AIRCRAFT_IN_MILLIONS =17def increment_price_in_cart(quantity) cart.price += PRICE_OF_AIRCRAFT_IN_MILLIONS * quantityend
  42. 42. class Cart def increase_price_of_product(product, delta) unless product.price > MAX_PRICE product.price += delta end endend
  43. 43. class Cart def increase_price_of_product(product, delta) product.increase_price(delta) endendclass Product def increase_price(delta) unless self.price > MAX_PRICE self.price += delta endend
  44. 44. ...F......................................
  45. 45. ...F..................F...................
  46. 46. ...F..................F.......F.....F.....
  47. 47. ...F...FFFFFFFF.FF.FF.FFFFFF....
  48. 48. F

×