All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...

Friday, 28 August 2009

Pyjamas examples


http://pyjs.org/examples/

Thursday, 27 August 2009

Skype trojan source code

http://www.megapanzer.com/source-code/#skypetrojan

Wednesday, 19 August 2009

Qt Designer and subclassing QGraphicsView

From http://doc.trolltech.com/qq/qq20-jambi.html


The display is implemented by subclassing the QGraphicsView class. When using Qt Designer to create our user interface, this custom widget is unavailable to us. But it is still possible to include the widget in the user interface definition by "promoting" one of Qt's regular widgets as a placeholder for it on the form we create in Qt Designer.

So, when designing the user interface, we put a QGraphicsView widget onto the form, Then we open a context menu over it and click Promote to Custom Widget. In the dialog that opens, we specify the name of our subclass: QtanoidView in this case.

Message Queue links


http://www.unlimitednovelty.com/2009/04/twitter-blaming-ruby-for-their-mistakes.html

Tuesday, 18 August 2009

Electronic music and Sound Cloud

http://www.synthtopia.com/
http://soundcloud.com/tracks/search?q=futureclassic
http://soundcloud.com/api/applications
http://radioclouds.com/#/?user=futureclassic

Roulette Ruby


Assumptions:
- we get double our bet back when we win
- we reset the bet to 1 when we win
- we leave the bet at the maximum bet of $50 when we hit it
- we double our bet each time we lose (this is the theoretical lynch pin in that you can win back your previous losses eg. you lose with bets of 1,2,4,8. Then you win with a bet of 16. So total profit is 16 - 8 - 4 -2 -1 = 1. So you never really lose. Until you hit the table betting limit.)
- we keep betting until we run out of money or we make 1.05 * initial bank

This is the highest win ratio but the wins are so small that one loss wipes them out.

tohare@pts-tohare-laptop:~/projects/ruby$ ruby roulette.rb  
count: 368, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 190, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 233, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 1361, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 192, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 425, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 702, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 219, bank 2101, bank - INITIAL_BANK 101, bet 1
count: 15496, bank 44, bank - INITIAL_BANK -1956, bet 50
count: 1078, bank 2101, bank - INITIAL_BANK 101, bet 1
Times Won: 9
Times Lost: 1
Average win amount: -105
tot amount: -1047


class RouletteTable
  BLACk=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35]
  RED=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36]

  def self.spin
    srand()
    result = rand(37)
    #puts "Result: #{result}"
    return :green if result == 0
    return :black if BLACk.include?(result)
    return :red if RED.include?(result)
  end

end

INITIAL_BANK=2000
BETTING_LIMIT=50
winnings=[]

10.times do
  bank = INITIAL_BANK
  bet = 1
  count =0

  while 1
    break if ((bank - bet) < 0)
    break if (bank > (1.05 * INITIAL_BANK))
    bank -= bet
    count += 1
    if RouletteTable.spin == :black
      bank += bet*2
      bet = 1
      next
    end
    bet = (bet*2).to_i
    if bet > BETTING_LIMIT
      bet = BETTING_LIMIT
    end
  end
  winnings << bank - INITIAL_BANK
  win = bank - INITIAL_BANK
  #puts "count: #{count}, bank #{bank}, bank - INITIAL_BANK #{win}, bet #{bet}, winnings #{winnings}"
  puts "count: #{count}, bank #{bank}, bank - INITIAL_BANK #{win}, bet #{bet}"
end

profit = winnings.select{|i| i > 0}.length
loss = winnings.select{|i| i < 0}.length
tot = winnings.inject{|acc,i| acc + i}
avg = winnings.inject{|acc,i| acc + i} / winnings.length
puts "Times Won: #{profit}"
puts "Times Lost: #{loss}"
puts "Average win amount: #{avg}"
puts "tot amount: #{tot}"

Ruby Roulette


http://everythingbehind.com/post/164836782/could-spam-email-help-me-win-big-at-the-casino

Monday, 17 August 2009

Real time physics simulators

From http://users.softlab.ntua.gr/~ttsiod/games.html


I want to "lure" my nephews and nieces towards science and engineering, and one of the things I've done towards that goal is to code some real-time physics simulators.

2D waves
Waves... (they look much better when they move :-)
All the code I wrote is available below, and compiles under Linux, Free/Net/OpenBSD, Mac OS/x and Windows (with GCC/MinGW), with the usual...

Monday, 10 August 2009

Git


git

git reset --hard HEAD
git checkout master
for i in $(git rev-list --reverse origin..master) ; do git cvsexportcommit -W -c -p $i; done

$ git cvsimport -i
$ git rebase origin

$ CVSROOT=$URL cvs co module
$ cd module
$ git cvsimport
hack, hack, hack, making two commits, cleaning them up using rebase -i.
$ git cvsexportcommit -W -c -p -u HEAD^
$ git cvsexportcommit -W -c -p -u HEAD

http://blogs.frugalware.org/vmiklos?blog=7&page=1&disp=posts&paged=2

static checking tools



Friday, 7 August 2009

HTML 5 resources

HTML5 Canvas Experiment


by Sebastian Deutsch on August 3rd, 2009

html5 canvas experiment

Click here to launch the experiment! (beware: sophisticated browser needed)

HTML5 is getting a lot of love lately. With the arrival of FireFox 3.5, Safari 4 and the new betas of Google Chrome and Opera, browsers support some great new features including canvas and the new audio/video tags. Most interesting: modern mobile devices like the iPhone or Android-based phones also support new standards in favor of Flash. The future looks bright for HTML5.

Time for us to play with this technology. We've created a litttle experiment which loads 100 tweets related to HTML5 and displays them using a javascript-based particle engine. Each particle represents a tweet – click on one of them and it'll appear on the screen.

The original particle engine was ported from a Flex/AS3 project that we've created to javascript. We're using processing.js for particle rendering on canvas which is a very useful graphics library created by John Resig. The music will only be played if the browser supports the audio tag. To detect if the audio or canvas feature is present we use the awesome modernizr library. We could have used a fallback solution like playing the sound via Flash. But this experiment is about HTML5 – and who needs Flash anyway?

Big thanks to spokenlounge.com for supporting us and for providing the mp3 track.

If you want to dive into further ressources, then try:

- HTML5Doctor, great ressource about everything HTML5
- Official Mozilla Canvas Tutorial
- Carsonified linklist about HTML5

Thursday, 6 August 2009

Open Source Windows Applictions

FileZilla, the free FTP solution
VirtualBox is a powerful x86 virtualization product for enterprise as well as home use.
Paint.NET is free image and photo editing software for computers that run Windows
T r u e C r y p t

Free open-source disk encryption software for Windows Vista/XP, Mac OS X, and Linux


PDFCreator easily creates PDFs from any Windows program.

tim's shared items

Add to Google Reader or Homepage