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
SECTION .data | |
msg db "Hello world" | |
len equ $ - msg | |
fname db "test", 0 | |
SECTION .text | |
global _start | |
_start: | |
mov rdi, fname ;param1 to open(), file name | |
mov rsi, 101 ;param2 to open(), file mode |
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 a simple Bloom Filter | |
# @author Matt McCollow <[email protected]> | |
import hashlib | |
class Filter(): | |
def __init__(self, debug=False): | |
self.bits = 0x0 | |
self.mask = 0xFFFF |
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
<?php | |
function extractFits($parameterArray, $dsid, $file, $file_ext) { | |
$file_name = $file .'_'. $dsid .'.xml'; | |
$output = array(); | |
exec('fits.sh -i '. escapeshellarg($file) .'', $output); | |
if ( !file_put_contents($file_name, implode("\n", $output)) ) { | |
exit("Error writing file: ". $file_name); | |
} | |
$_SESSION['fedora_ingest_files']["$dsid"] = $file_name; |
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
[...] | |
map_label = mods_tree.xpath("*[local-name() = 'titleInfo']/*[local-name() = 'title']/text()") | |
map_label = unicode(map_label[0].strip("\t\n\r"), encoding='utf-8') | |
[...] | |
map_pid = fedora.getNextPID(name_space) | |
map_object = fedora.createObject(map_pid, label = map_label.encode('utf-8')) | |
---------- | |
Traceback (most recent call last): |
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
<?xml version="1.0" encoding="UTF-8"?><oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:srw_dc="info:srw/schema/1/dc-schema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> | |
<dc:title> | |
Aosta, Italy - 1:250,000 topographical map | |
</dc:title> | |
<dc:contributor>Great Britain. War Office. General Staff. Geographical Section. (creator)</dc:contributor> | |
<dc:publisher> | |
London: War Office | |
</dc:publisher> | |
<dc:language>eng</dc:language> |
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
import urllib2 | |
import HTMLParser | |
from BeautifulSoup import BeautifulSoup | |
import time | |
def _fetch_page(url): | |
try: | |
page = urllib2.urlopen(url) | |
soup = BeautifulSoup(page) | |
except urllib2.URLError: |
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
import twitter | |
import networkx as nx | |
import re | |
g = nx.DiGraph() | |
def get_tweets(): | |
twitter_search = twitter.Twitter(domain="search.twitter.com") | |
search_results = [] | |
for page in range(1,6): |
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(pascal). | |
-export([triangle/1]). | |
% Generates a Pascal's Triangle | |
% 1. Start Erlang interpreter in folder with this file | |
% 2. Do: c(pascal). | |
% 3. Do: pascal:triangle(5). | |
% Which would create a Pascal's Triangle 5 lines deep. | |
% calculate factorial |
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
#lang scheme | |
(define (cube-root x) | |
(define (approx guess x) | |
(if (good-enough? guess x) | |
guess | |
(approx (improve guess x) x))) | |
(define (improve guess x) | |
(/ (+ (/ x (square guess)) (* 2 guess)) 3)) | |
(define (good-enough? guess x) | |
(< (abs (- (cube guess) x)) 0.001)) |
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
<?php | |
/** | |
* json_encode() only takes an $option argument in PHP 5.3.0+ | |
* We need the FORCE_JSON_OBJECT option, so we'll roll our | |
* own json_encode() on PHP < 5.3.0 | |
* @author Matt McCollow <[email protected]> | |
*/ | |
if(!defined('JSON_FORCE_OBJECT')) { |
NewerOlder