n3paste.de

::

a haskell happstack pastebin

  • New paste
  • View pastes

  • Login

  • About
  • Most recent pastes

    Filter pastes (help):

    18:16 - Wed 2012.02.22

    Python

    Paste: /u30d/Show related

    iterable ogg encoder

    
    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()
    

    14:40 - Mon 2012.02.20

    HTML

    Paste: /DCwL/Show related

    No description.

    <!DOCTYPE html>
    <meta charset="utf-8" />
    
    <title>Test</title>
    
    <h1>HTML5 test</h1>
    
    <p>Ist das wirklich in Ordnung so?</p>
    

    00:36 - Sun 2012.02.19

    C++

    Paste: /Vj1I/Show related

    Reply to /hMjo/

    #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);
    

    23:54 - Sat 2012.02.18

    C++

    Paste: /hMjo/Show related

    No description.

    #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);
    

    02:35 - Sat 2012.02.18

    Plaintext

    Paste: /sY/Show related

    No description.

    dawd awd awd awd asd awd a
    d
     a
    wd a
    wd
    
     a
    wf
     wg
    

    19:38 - Sat 2012.02.11

    Plaintext

    Paste: /uyA7/Show related

    varnish foo

    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>
    

    18:21 - Sat 2012.02.11

    Lua

    Paste: /OP/Show related

    No description.

    		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)))
    

    12:51 - Thu 2012.02.09

    Plaintext

    Paste: /q8Z/Show related

    httperf stress test

    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
    

    16:38 - Wed 2012.02.08

    Haskell

    Paste: /x4P/Show related

    No description.

    delEven :: (Integral a) => [[a]] -> [[a]]
    delEven xss = [y | y <- [xs | xs <- xss], even y]
    

    23:36 - Tue 2012.02.07

    Haskell

    Paste: /PIH/Show related

    Reply to /wad/

    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)
    

    23:34 - Tue 2012.02.07

    Haskell

    Paste: /wad/Show related

    Reply to /dd/

    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)
    

    23:26 - Tue 2012.02.07

    Haskell

    Paste: /dd/Show related

    No description.

    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)
    

    14:59 - Tue 2012.02.07

    Plaintext

    Paste: /r7y5/Show related

    No description.

    {-# LANGUAGE OverloadedStrings #-}
    
    import Snap
    
    main :: IO ()
    main = quickHttpServe $ do
      route [ ("foo", writeBS "Foo!")
            , ("bar", writeBS "Bar!") ]
    

    12:25 - Tue 2012.02.07

    Haskell

    Paste: /uWc/Show related

    No description.

    e m = m * c ^ 2.0
      where
         c = 3 e 9
    

    12:09 - Tue 2012.02.07

    Plaintext

    Paste: /7uz/Show related

    No description.

    apply_f_twice :: Int -> Int -> Int -> Int
    apply_f_twice f x = f (f x)
    

    10:27 - Tue 2012.02.07

    Plaintext

    Paste: /cTJu/Show related

    No description.

    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!"
    

    09:04 - Tue 2012.02.07

    Plaintext

    Paste: /tst/Show related

    No description.

    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).
    
    
    

    21:59 - Mon 2012.02.06

    Haskell

    Paste: /5CW/Show related

    No description.

    constantSpeed :: Int
    cosntantSpeed = 260
    

    20:20 - Mon 2012.02.06

    Plaintext

    Paste: /dpM/Show related

    No description.

    %> 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)
    

    21:31 - Fri 2012.02.03

    Plaintext

    Paste: /luEB/Show related

    new paste test

    testing the pastie