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
from pytc import HDB, HDBOWRITER, HDBOCREAT | |
import os | |
class Session: | |
""" Simple session class example. | |
Reading is faster than writing, because every write causes db activity """ | |
hdb = None | |
dbpath = "session.tch" | |
def __getitem__(self, key): | |
ans = getattr(self, key, None) |
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
/* Argument to binary representation */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) | |
{ | |
int num = 0; | |
int i; | |
if(argc < 2) |
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
#!/bin/bash -x | |
# Copyright (c) 2009 Mats Rauhala <[email protected]> | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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
#!/bin/bash | |
# Removes valid ips' from denyhosts files. Checks that the input is not empty, | |
# no further checks are made | |
# | |
# Usage: validip.sh ip | |
if [ "x$1" == "x" ]; then | |
echo "Input value required" | |
exit 1 | |
fi | |
workdir=/var/lib/denyhosts |
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 twitter | |
import pynotify | |
from time import sleep | |
from getpass import getpass | |
from sys import exit | |
from os import fork | |
pynotify.init("Identi.ca") |
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
#!/bin/sh | |
# Combining a scanner and a printer as a copy machine. Idea from | |
# http://mulps.wordpress.com/2009/06/20/scanner-printer-copy-machine/ | |
# with little enhancements. | |
# Filenames | |
export SANE_DEFAULT_DEVICE="plustek:libusb:002:002" | |
original=$(mktemp) | |
reoriented=$(mktemp) |
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
/* | |
Copyright (c) 2010 Mats Rauhala <[email protected]> | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, | |
copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the | |
Software is furnished to do so, subject to the following |
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
{-# LANGUAGE OverloadedStrings #-} | |
import Data.List (foldl', sort) | |
import Data.Text.Lazy (Text) | |
import qualified Data.ByteString.Lazy as BL (ByteString(..), readFile) | |
import qualified Data.Map as M (assocs, insertWith', empty) | |
import qualified Data.Text.Lazy as T (words, lines, unpack, pack, append) | |
import qualified Data.Text.Lazy.Encoding as TE (decodeUtf8) | |
import qualified Data.Text.Lazy.IO as TI (putStrLn) | |
import Network.URI(parseURI, uriAuthority, uriRegName) |
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
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-} | |
import Network.CGI | |
import Text.Hamlet | |
import Text.Cassius | |
import qualified Data.ByteString.Char8 as BS8 | |
import System.Directory (doesFileExist) | |
import Data.Map (Map) | |
import qualified Data.Map as M | |
import Data.List (foldl') | |
import System.Environment |
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
BEGIN; | |
CREATE TABLE Employee (Fname, Minit, Lname, Ssn PRIMARY KEY, Bdate, | |
Address, Sex, Salary, Super_ssn, Dno, FOREIGN KEY (Super_ssn) | |
REFERENCES Employee (Ssn)); | |
CREATE TABLE Department (Dname, Dnumber PRIMARY KEY, Mgr_ssn, Mgr_start_date, FOREIGN KEY (Mgr_ssn) REFERENCES Employee (Ssn)); | |
CREATE TABLE Dept_locations (Dnumber, Dlocation, PRIMARY KEY (Dnumber, Dlocation), FOREIGN KEY (Dnumber) REFERENCES Department (Dnumber)); | |
CREATE TABLE Works_on (Essn, Pno, Hours, PRIMARY KEY (Essn, Pno), FOREIGN KEY (Essn) REFERENCES Employee (Ssn)); | |
CREATE TABLE Project (Pname, Pnumber PRIMARY KEY, Plocation, Dnum, FOREIGN KEY (Dnum) REFERENCES Department (Dnumber)); | |
CREATE TABLE Dependent (Essn, Dependent_name, Sex, Bdate, Relationship, PRIMARY KEY (Essn, Dependent_name), FOREIGN KEY (Essn) REFERENCES Emplyee (Essn)); |
OlderNewer