Most recent pastes
class AudioStreamIterable(object): chunk_size = 8096 decoders = { "ogg": ("/usr/bin/oggdec", "-Q", "-o", "-"), "flac": ("/usr/bin/flac", "-d", "-c", "--totally-silent"), "mp3": ("/usr/bin/mpg123", "-s", "-q"), } encoder = "/usr/bin/oggenc" def __init__(self, filename, bitrate): self.filename = filename self.bitrate = bitrate name, found, suffix = filename.rpartition(".") self.decoder_cmd = list(self.decoders[suffix] + (filename, )) self.encoder_cmd = [self.encoder, "-r", "-Q", "-b", str(bitrate), "-"] def __iter__(self): self.p1 = subprocess.Popen(self.decoder_cmd, stdout=subprocess.PIPE) self.read_fd, self.write_fd = os.pipe()
<!DOCTYPE html> <meta charset="utf-8" /> <title>Test</title> <h1>HTML5 test</h1> <p>Ist das wirklich in Ordnung so?</p>
#include <algorithm> #include <iostream> #include <vector> using namespace std; class graph { public: graph(int count) : _paths(0) , _accessibility(count) { for (int i = 0; i < count; i++) { _accessibility.push_back(vector<bool>(count)); _accessibility[i].resize(count); fill(_accessibility[i].begin(), _accessibility[i].end(), false); } _used.resize(count); fill(_used.begin(), _used.end(), false);
#include <algorithm> #include <iostream> #include <vector> using namespace std; class graph { public: graph(int count) : _paths(0) , _accessibility(count) { for (int i = 0; i < count; i++) { _accessibility.push_back(vector<bool>(count)); _accessibility[i].resize(count); fill(_accessibility[i].begin(), _accessibility[i].end(), false); } _used.resize(count); fill(_used.begin(), _used.end(), false);
site: http://valhalla.phryk.net:4242/
varnish: http://valhalla.phryk.net/
config:
backend default {
.host = "127.0.2.6";
.port = "4242";
}
127.0.0.2.6 because:
0:root@valhalla ~ # ifconfig lo0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet 127.0.2.6 netmask 0xffffffff
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
local function attractor(distance, entity) if get_player(entity) == get_player() then if get_type(entity) == BASE or get_type(entity) == PLANET then if distance < 500 then return -1 else return 2 * math.exp((0-distance) / 2000) end else --if distance < 500 then return math.max(-10, ((0-700)/distance)) --else -- return 0 --end end elseif get_player(entity) ~= 0 then if get_type(entity) == SHIP then return math.max(-10, math.min(1, math.pow((distance - 300) / 300, 3))) else return math.max(-10, math.min(10, math.pow((distance - 300) / 300, 3)))
0:phryk@pancakes ~ % httperf --num-conns=50 --num-calls=1000 --server=valhalla.phryk.net --port=4242 --uri=Testing/Lorem%20Ipsum%20undso httperf --client=0/1 --server=valhalla.phryk.net --port=4242 --uri=Testing/Lorem%20Ipsum%20undso --send-buffer=4096 --recv-buffer=16384 --num-conns=50 --num-calls=1000 httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE Maximum connect burst length: 1 Total: connections 50 requests 50000 replies 50000 test-duration 4804.803 s Connection rate: 0.0 conn/s (96096.1 ms/conn, <=1 concurrent connections) Connection time [ms]: min 90163.8 avg 96096.1 max 111334.9 median 95174.5 stddev 3991.5 Connection time [ms]: connect 30.1 Connection length [replies/conn]: 1000.000 Request rate: 10.4 req/s (96.1 ms/req) Request size [B]: 97.0 Reply rate [replies/s]: min 3.2 avg 10.4 max 13.0 stddev 1.3 (961 samples) Reply time [ms]: response 56.9 transfer 39.1 Reply size [B]: header 145.0 content 6314.0 footer 0.0 (total 6459.0) Reply status: 1xx=0 2xx=50000 3xx=0 4xx=0 5xx=0
len :: [a] -> Int len [] = 0 len (_:xs) = 1 + len xs sum' :: Num a => [a] -> a sum' [] = 0 sum' (x:xs) = x + sum' xs avrg :: (Real a, Fractional b) => [a] -> b avrg l = realToFrac (sum' l) / fromIntegral (len l) foo :: [Int] foo = [1,2,3,4,5] bar :: [Double] bar = [1,2,3,4,5] main :: IO () main = print (avrg foo, avrg bar)
len :: [a] -> Int len [] = 0 len (_:xs) = 1 + len xs sum' :: Num a => [a] -> a sum' [] = 0 sum' (x:xs) = x + sum' xs avrg :: (Fractional a) => [a] -> a avrg l = sum' l / fromIntegral (len l)
len :: [a] -> Int len [] = 0 len (_:xs) = 1 + len xs sum' :: Num a => [a] -> a sum' [] = 0 sum' (x:xs) = x + sum' xs avrg :: (Num a, Integral a, Fractional b) => [a] -> b avrg l = fromIntegral (sum' l) / fromIntegral (len l)
{-# LANGUAGE OverloadedStrings #-}
import Snap
main :: IO ()
main = quickHttpServe $ do
route [ ("foo", writeBS "Foo!")
, ("bar", writeBS "Bar!") ]
bmiTell :: (RealFloat a) => a -> a -> String
bmiTell weight height
| weight / height ^ 2 <= 18.5 = "You're underweight, you emo, you!"
| weight / height ^ 2 <= 25.0 = "You're supposedly normal. Pffft, I bet you're ugly!"
| weight / height ^ 2 <= 30.0 = "You're fat! Lose some weight, fatty!"
| otherwise = "You're a whale, congratulations!"
bash-3.00# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <LSILOGIC-1030IM IM-1000 cyl 65533 alt 2 hd 16 sec 136>
/pci@1f,700000/scsi@2/sd@0,0
1. c1t2d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1f,700000/scsi@2/sd@2,0
2. c1t3d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1f,700000/scsi@2/sd@3,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c1t0d0s7 is currently mounted on /export/home. Please see umount(1M).
%> adb logcat|grep -i "uptime"
- waiting for device -
I/ActivityManager( 51): Start proc de.uhuc.android.uptime for broadcast de.uhuc.android.uptime/.UptimeClientReceiver: pid=160 uid=10024 gids={3003, 1015}
D/UptimeClientReceiver( 160): android.intent.action.BOOT_COMPLETED
D/UptimeClientService( 160): onCreate()
D/UptimeClientService( 160): de.uhuc.android.uptime.UptimeClientService
D/UptimeClientService( 160): next interval: 300
I/ActivityManager( 51): Starting activity: Intent { cmp=de.uhuc.android.uptime/.UptimeClient }
W/ActivityManager( 51): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=de.uhuc.android.uptime/.UptimeClient }
I/ActivityManager( 51): Displayed activity de.uhuc.android.uptime/.UptimeClient: 388 ms (total 388 ms)
testing the pastie