Skip to content

Instantly share code, notes, and snippets.

(* File: dragon.ml
* Description: A naive implementation of the dragon curve fractal
* Author: Damien Schoof - 2010
* To build:
* ocamlopt -o dragon graphics.cmxa dragon.ml
*)
open Graphics
type rotation = Left | Right
let size = 5
@am0d
am0d / code.py
Created November 8, 2011 03:39
BeautfulSoup - split single HTML file into multiple pages
from BeautifulSoup import BeautifulSoup, Tag
import re
# Read the raw file into raw
f = open("BoP - APV - taggeds.html")
raw = f.read()
print '[*] Read raw text in'
# Construct a BeautifulSoup out of the raw HTML
soup = BeautifulSoup(raw)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "listener.py", line 9
sock.listen(5)
^
@am0d
am0d / bin-tree.rs
Created October 13, 2012 19:00
Sample showing llvm crash
extern mod std;
struct Tree {
mut leftTree: @Option<Tree>,
mut rightTree: @Option<Tree>,
key: int
}
impl Tree {
@am0d
am0d / binary-tree.rs
Created October 17, 2012 02:01
Basic binary tree with garbage collection, implemented in Rust
extern mod std;
struct Tree/&{
mut leftTree: Option<~Tree>,
mut rightTree: Option<~Tree>,
key: int
}
impl Tree {
fn insert(&self, i: int) -> () {
@am0d
am0d / stderr
Created November 2, 2012 02:28
Sample showing tcp stack segmentation fault on function exit
$ ./tcp_fail
rust: ~"tcp_connect result_ch Chan_(12)"
rust: ~"stream_handle_ptr outside interact 139825144411888"
rust: ~"in interact cb for tcp client connect.."
rust: ~"stream_handle_ptr in interact 139825144411888"
rust: ~"tcp_init successful"
rust: ~"dealing w/ ipv4 connection.."
rust: ~"addr: &{ mut sin_family: 2, mut sin_port: 0, mut sin_addr: 2470494893, mut sin_zero: (0, 0, 0, 0, 0, 0, 0, 0) }"
rust: ~"tcp_connect successful"
rust: ~"leaving tcp_connect interact cb..."
@am0d
am0d / hashmap.rs
Created November 8, 2012 05:27
Illegal borrow issue
extern mod std;
use std::map;
use std::map::HashMap;
struct HeaderCollection {
mut header_collection: HashMap<~str, ~str>
}
fn HeaderCollection () -> HeaderCollection {
HeaderCollection {
@am0d
am0d / backtrace
Created November 14, 2012 03:20
Rustc backtrace
rust: task failed at 'expected EMBL doc with tag EsInt but found tag 11', /home/a_m0d/workspace/rust/rust-git/src/libstd/ebml.rs:464
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x5d)[0x7f4416e0c61d]
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt.so(+0x2cc59)[0x7f4416e1fc59]
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt.so(upcall_fail+0x1b0)[0x7f4416e0ed00]
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-4782a756585a81-0.5.so(_ZN4ebml14__extensions__10meth_136578next_doc16_b11edfaa9805f9d3_05E+0xe24)[0x7f4418105324]
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/libstd-4782a756585a81-0.5.so(_ZN4ebml14__extensions__10meth_138288read_int17_d357f03dfd89837b3_05E+0x61)[0x7f4418107b11]
/home/a_m0d/workspace/rust/rust-git/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-c848252
@am0d
am0d / stderr
Created November 15, 2012 00:41
Small file showing compiler crash on imports
$ rustc tcp_fail.rs
tcp_fail.rs:3:4: 3:17 error: failed to resolve import
tcp_fail.rs:3 use std::net::ip;
^~~~~~~~~~~~~
tcp_fail.rs:4:4: 4:18 error: failed to resolve import
tcp_fail.rs:4 use std::net::tcp;
^~~~~~~~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors
rust: task failed at 'explicit failure', /home/a_m0d/workspace/rust/rust-git/src/libsyntax/diagnostic.rs:78
@am0d
am0d / jsGrid.js
Last active December 15, 2015 12:29
/**
* Created with PyCharm.
* User: a_m0d
* Date: 3/27/13
* Time: 9:55 PM
*/
(function (w, d, $) {
'use strict';