This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
hash_table_dump (GHashTable * hash_table) | |
{ | |
GHashTableIter iter; | |
gpointer key; | |
gpointer value; | |
g_hash_table_iter_init (hash_table, &iter); | |
while (g_hash_table_iter_next (&iter, &key, &value)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Concurrent (forkIO) | |
import Control.Monad (forever, unless) | |
import Network (PortID(PortNumber),listenOn) | |
import Network.Socket hiding (listen,recv,send) | |
import Network.Socket.ByteString (recv,sendAll) | |
import qualified Data.ByteString as S | |
import System.Posix (Handler(Ignore),installHandler,sigPIPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import time | |
import signal | |
from subprocess import Popen, PIPE | |
dd = Popen(['dd'] + sys.argv[1:], stderr=PIPE) | |
while dd.poll() is None: | |
time.sleep(.3) | |
dd.send_signal(signal.SIGUSR1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Play a song and flash LEDs on alternate notes. | |
-- Lee Pike <lee pike @ gmail . com> (remove spaces) | |
-- See http://leepike.wordpress.com/?p=427 | |
-- BSD3 License | |
-- | |
-- Note timing issues: http://www.arduino.cc/en/Tutorial/PlayMelody | |
-- | |
module CopilotSing where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Echo server program | |
module Main where | |
import Control.Monad (unless,when) | |
import Network.Socket hiding (recv) | |
import qualified Data.ByteString as S | |
import Data.Word(Word8) | |
import Control.Concurrent(threadDelay) | |
import Data.List | |
import Numeric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# [sudo] gem install mechanize | |
# ruby tumblr-photo-ripper.rb | |
require 'rubygems' | |
require 'mechanize' | |
# Your Tumblr subdomain, e.g. "jamiew" for "jamiew.tumblr.com" | |
site = "doctorwho" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
-- kreed131.blogspot.com/2011/07/tcp-haskell-networksocket.html | |
--- | |
import Network.Socket hiding (send, recv) | |
import Network.Socket.ByteString | |
import Control.Concurrent (forkIO) | |
import qualified Data.ByteString.Char8 as B8 | |
import System.Environment (getArgs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- Implementation of BST (binary search tree) | |
Script is absolutly free/libre, but with no guarantee. | |
Author: Ondrej Profant -} | |
import qualified Data.List | |
{- DEF data structure -} | |
data (Ord a, Eq a) => Tree a = Nil | Node (Tree a) a (Tree a) | |
deriving Show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* All fields are big endian byte order. | |
* Magic: 9 bytes (0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a) | |
* Version: 2 bytes | |
* Lib version: 2 bytes | |
* Version needed: 2 bytes | |
* Method: 1 byte | |
* Level: 1 byte | |
* Flags: 4 byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data BinaryTree a = EmptyTree | Node a (BinaryTree a) (BinaryTree a) | |
deriving (Show) | |
treeInsert :: Ord a => a -> BinaryTree a -> BinaryTree a | |
treeInsert el EmptyTree = Node el EmptyTree EmptyTree | |
treeInsert el (Node a left right) | |
| el == a = Node el left right | |
| el < a = Node a (treeInsert el left) right | |
| el > a = Node a left (treeInsert el right) |
OlderNewer