This example needs Ruby 1.9.
Two ways to run this:
$ ./pixelizer.rb infile.png > outfile.png
$ ./pixelizer.rb - > outfile.png < infile.png
package main | |
import ( | |
"code.google.com/p/go.net/websocket" | |
"flag" | |
"log" | |
"net/http" | |
"os" | |
) |
irb(main):001:0> class A | |
irb(main):002:1> @@variable = 'a' | |
irb(main):003:1> end | |
=> "a" | |
irb(main):004:0> class B < A | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> B.class_variables | |
=> [] | |
irb(main):007:0> B.class_variable_defined?(:@@variable) |
#!/bin/sh | |
BROKEN="" | |
IFS=" | |
" | |
for package in `dpkg -l | awk '{ if ($1 == "ii") { print $2 } }'`; do | |
STATUS="Okay" | |
printf "Checking %s..." $package |
ActiveRecord SHell (or ARSH for short). | |
Here's the code that actually works. I have been working on a | |
half-baked pager for the shell, but the code's so ugly I'm not willing | |
to share it. At least this allows someone to continue the "project". | |
The original idea was this: | |
- ls should list available ActiveRecord classes and modules containing | |
ActiveRecord classes. |
$ lspci; cat /proc/cpuinfo ; dmesg; free -tm; uptime | |
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 13) | |
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13) | |
00:02.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 2 (rev 13) | |
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 13) | |
00:04.0 PCI bridge: Intel Corporation 5520/X58 I/O Hub PCI Express Root Port 4 (rev 13) | |
00:05.0 PCI bridge: Intel Corporation 5520/X58 I/O Hub PCI Express Root Port 5 (rev 13) | |
00:06.0 PCI bridge: Intel Corporation 5520/X58 I/O Hub PCI Express Root Port 6 (rev 13) | |
00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 13) | |
00:08.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 8 (rev 13) |
# ViaViela Verkoop spamt graag | |
if message.from.email =~ /[email protected]/ | |
message.remove_label :inbox | |
message.add_label :spam | |
log "Verkoop spam: #{message.id}" | |
end |
#!/usr/bin/ruby1.9.1 | |
results = [ | |
{id: 4, data: "level2", pid: 3}, | |
{id: 1, data: "level1", pid: 0}, | |
{id: 0, data: "level0", pid: nil}, | |
{id: 2, data: "level2", pid: 1}, | |
{id: 2, data: "levelX", pid: 10}, | |
{id: 3, data: "level1", pid: 0} | |
] |
class String | |
def encode_to_i | |
result = 0 | |
self.split.each_with_index do |c, i| | |
result += c.ord << (i * 8) | |
end | |
result | |
end | |
def ==(s) |