staff:

Twenty 

A short film by William Wilkinson. (previously)

Posted on October 4, 2011

Reblogged from: Tumblr Staff

Source: willw

Notes: 4,197 notes

Comments: View comments

Tags: Film,LOL,

Playing with Ruby + Processing + Audio

Don’t really know, what i wrote… but this thing can react on audio beats ))) and you can specify channels to visualize(circle).

Controls:

“a”, “s” — sets minimum & maximum samples to display as circle
“d” — output current min & max
“x” — exit xD

And don’t forget to put sound.mp3 near .rb file

You need ruby-processing gem. Tested at 1.9.2

require "pp"

class Visualizer < Processing::App
  load_library "minim"
  import "ddf.minim"
  import "ddf.minim.analysis"

  def setup
    smooth
    color_mode(RGB, 255)
    size(1280, 600)
    background(0)

    @min = 0
    @max = 2

    setup_sound
  end

  def setup_sound
    @minim = Minim.new(self)
    @input = @minim.get_line_in
    @input = @minim.loadFile("sound.mp3", 1024)
    @input.play

    @fft = FFT.new(@input.bufferSize, @input.sampleRate)
  end

  def draw
    background(0)

    avg = 0

    @fft.forward(@input.left)
    @fft.specSize.times { |i|
      stroke(255)

      case i
      when @min..@max
        stroke(255, 0, 0)
        # remove if statement for pure detection
        avg += @fft.getBand(i) if @fft.getBand(i) > 100
      end

      line(i, 600, i, @fft.getBand(i));
    }

    avg = (avg / (@max - @min)) * 10

    noStroke
    fill(255, 255, 0)
    ellipse(800, 300, avg, avg)
  end

  def keyPressed
    case key
    when "a"
      @min = mouseX if mouseX < @max && mouseX >= 0
    when "s"
      @max = mouseX if mouseX > @min && mouseX <= @fft.specSize
    when "d"
      puts "#{@min} #{@max}"
    when "x"
      exit
    end
  end

  def stop
    @input.pause
    @minim.stop
    super
  end
end

Visualizer.new :title => "Visualizer"

Transfering mysql database from another server to localhost

Very often i’m in need of moving external database to my own pc, bored of ssh + mysqldump + tar -zcf + scp + mysql < file

And here goes, oneliner:

ssh user@server 'mysqldump -uUSER -pPASSWORD DATABASE_NAME | gzip' | gunzip | mysql5 -uUSER -pPASSWORD DATABASE_NAME

Samsung ISN’T copying Apple!!! Trust me!

There goes just 2 images, why Samsung is 100% different from Apple.

We should help wikipedia, it need us!

We should help wikipedia, it need us!

Power of Zen Coding

I found interest plugin for most IDEs (and for textmate too), named Zen Coding.
It lets you take advantage of writing html as css selectors.

As example:

a.no-trans[href="#"]>img.bordered

will be converted to

<a class="no-trans" href="#"><img class="bordered" src="" alt="" /></a>

And, if you wish something harder… looks at this:

div.catalog>ul>li*4>(div>a[href="#"]>img)+(div>a[href="#"]{item_name})+(div.rating>(img*5))+(table.w100>tr>td*2)+(div.links>a[href="#"]{Подробнее}+a[href="#"]{Добавить к сравнению})

Converted to

<div class="catalog">
  <ul>
    <li>
      <div><a href="#"><img src="" alt="" /></a></div>
      <div><a href="#">item_name</a></div>
      <div class="rating">
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
      </div>
      <table class="w100">
        <tr>
          <td></td>
          <td></td>
        </tr>
      </table>
      <div class="links"><a href="#">Подробнее</a><a href="#">Добавить к сравнению</a></div>
    </li>
    <li>
      <div><a href="#"><img src="" alt="" /></a></div>
      <div><a href="#">item_name</a></div>
      <div class="rating">
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
      </div>
      <table class="w100">
        <tr>
          <td></td>
          <td></td>
        </tr>
      </table>
      <div class="links"><a href="#">Подробнее</a><a href="#">Добавить к сравнению</a></div>
    </li>
    <li>
      <div><a href="#"><img src="" alt="" /></a></div>
      <div><a href="#">item_name</a></div>
      <div class="rating">
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
      </div>
      <table class="w100">
        <tr>
          <td></td>
          <td></td>
        </tr>
      </table>
      <div class="links"><a href="#">Подробнее</a><a href="#">Добавить к сравнению</a></div>
    </li>
    <li>
      <div><a href="#"><img src="" alt="" /></a></div>
      <div><a href="#">item_name</a></div>
      <div class="rating">
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
        <img src="" alt="" />
      </div>
      <table class="w100">
        <tr>
          <td></td>
          <td></td>
        </tr>
      </table>
      <div class="links"><a href="#">Подробнее</a><a href="#">Добавить к сравнению</a></div>
    </li>
  </ul>
</div>

P.S. For some reason, in text ZC conflicts with some built-in hotkeys. And i found best way(for me) to replace them:

Change "Expand abbrevation" to (Command + Shift + E)
Unbind "Select next item", "Select previous item" 'cause they're conflicts with indentation of text (Command + ])
Unbind "Split or join tag", 'cause it conflicts with delete line bound to (Command + K)

Browsers as Girls

Why are you writing a bot for Dofus?

I'm not like, OMFG STOP BOTTIN MY PRECIOUS GAYME I'm just genuinely curious D:
- Anonymous

Oh… generally, it’s really interested to understand how games are created on network layer, understand main-loop things, better handling cpu-cycles, artificial intelligence… that’s all involved in bot development :)

share - Anonymous

until it will be finished, for 1 perfect action (i.e. farm => sell => store => farm & etc), there will be no releases

I love your site!!!! I am currently trying to teach myself Ruby at the moment! Any tips? How would i get started doing GUI with Ruby??? - mineshaft82

Depends on platform: mac => gtk/qt4/macruby/cocoa windows => doesn’t really know, because i didn’t used windows for much time

Top of Page