Skip to content

Instantly share code, notes, and snippets.

View deontologician's full-sized avatar
🦀
🌎

Josh Kuhn deontologician

🦀
🌎
View GitHub Profile
class Fastrclient(object):
""" Creates a connection object and manages all communication
with the server."""
def __init__(self, addr="localhost", port=4168):
self.clientsock = s.socket(s.AF_INET,s.SOCK_DGRAM)
self.addr = (addr,port)
self.count = 0
self.count_l = threading.Lock()
post_list = blobs_from_db
interested_in_formatting_posts = some_list1
interested_in_formatting_the_page = some_list2
# when modules are loaded they add methods to whatever "interest" lists they want
def format_posts():
for element in post_list: # list of text blobs from database
for formatter in interested_in_posts:
element = formatter(element)
// Sample army storage for Ressel:Arena
#include <iostream>
#include <list>
#include <string>
using namespace std;
// Setting up the Node data structure, in this case a clone of "soldier"
// From the Ressel:Arena game..
type Callback m a = [String] -> CommandLineT m a
type CallbackList m a = Map.Map String (Callback m a)
type Environment = Map.Map String String
data CommandState m a = CS { registry :: Environment
, callbacks :: CallbackList m a
}
newtype CommandLineT m a = CommandLine (StateT (CommandState m a) (InputT m) a)
{-# OPTIONS_GHC -fglasgow-exts #-}
module System.Console.CommandLine where
import System.Console.Haskeline
import Control.Monad.Trans (lift, MonadTrans)
import Control.Monad.State
import Control.Applicative
import qualified Data.Map as Map
---
- Card:
name: Lumber Mill
type: Structure
cost: free
abilities:
- Produce: (L)
defense: 4
unit_slots: 1
- Card:
for file in ./bad*; do ./dj-lex ${file} > /dev/null; if ["$?" != "0"]; then echo "lex error on ${file}"; fi; done
--
-- xmonad example config file.
--
-- A template showing all available configuration hooks,
-- and how to override the defaults in your own xmonad.hs conf file.
--
-- Normally, you'd only override those defaults you care about.
--
import XMonad
import turtle as T
from random import randint
def spiral(linefun, incr=4, angle=30, iterations = 30):
for i in xrange(0,iterations):
linefun(i*incr)
T.left(angle)
def regular_line(length):
T.forward(length)
habitue@chompy ~/b/libtasn1 $ makepkg PKGBUILD
==> Making package: lib32-libtasn1 2.8-2 (Fri Mar 11 02:14:09 EST 2011)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
-> Downloading libtasn1-2.8.tar.gz...
--2011-03-11 02:14:09-- ftp://ftp.gnu.org/gnu/libtasn1/libtasn1-2.8.tar.gz
=> “libtasn1-2.8.tar.gz.part”
Resolving ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... connected.