Skip to content

Instantly share code, notes, and snippets.

View AleXoundOS's full-sized avatar

AleXoundOS

  • Tbilisi, Georgia
  • 18:28 (UTC +04:00)
View GitHub Profile
@bert
bert / hash_table_dump.c
Created November 11, 2010 06:56
Dump a hash table
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))
{
@paul-r-ml
paul-r-ml / haskellTcpProxy.hs
Created December 12, 2010 13:06
simple Haskell TCP proxy
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)
@hikoz
hikoz / dd.py
Created December 15, 2010 04:45
dd with progress in python
#!/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)
--
-- 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
@marcmo
marcmo / echoServer.hs
Created March 23, 2011 08:00
simple haskell program for sending over socket and receiving a response with a timeout
-- 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
@jamiew
jamiew / tumblr-photo-ripper.rb
Created July 13, 2011 17:46
Download all the images from a Tumblr blog
# 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"
@kreed131
kreed131 / SimpleTCPServer.hs
Created July 22, 2011 20:16
Simple TCP Server on Haskell
---
-- 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)
@Kedrigern
Kedrigern / Tree.hs
Last active October 29, 2024 15:35
Implementation of binary search tree in Haskell
{- 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
@jledet
jledet / lzo_header.txt
Created November 2, 2011 15:19
LZO header
/*
* 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
@mmagm
mmagm / binary-tree.hs
Created May 26, 2012 12:01
haskell binary tree
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)