This file contains hidden or 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
| """ | |
| Simple python dice module. | |
| By sixthgear <sixthgear@sixthgear.ca> | |
| """ | |
| import random | |
| import fractions | |
| import itertools | |
| class Dice(object): |
This file contains hidden or 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
| -------------------------------------------------------------- | |
| DoomRL (v.0.9.9.6G) roguelike post-mortem character dump | |
| -------------------------------------------------------------- | |
| sixthgear, level 5 Human Private Marine, | |
| was splayed by a hell knight on level 7 of the Phobos base. | |
| He survived 46728 turns and scored 16092 points. | |
| He played for 51 minutes and 15 seconds. | |
| He didn't like it too rough. |
This file contains hidden or 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
| //The sum of the squares of the first ten natural numbers is, | |
| //12 + 22 + ... + 102 = 385 | |
| //The square of the sum of the first ten natural numbers is, | |
| //(1 + 2 + ... + 10)2 = 552 = 3025 | |
| /*Hence the difference between the sum of the squares of the first ten | |
| natural numbers and the square of the sum is 3025 − 385 = 2640.*/ | |
| /*Find the difference between the sum of the squares of the first one |
This file contains hidden or 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
| size_t | |
| func(short a[]) | |
| { | |
| return sizeof(a); | |
| } | |
| int | |
| main() | |
| { | |
| short arr[10]; |
This file contains hidden or 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
| # 0.06s user 0.00s system 75% cpu 0.081 total | |
| astronomical: 1 | |
| but: 627 | |
| commanded: 1 | |
| blazed: 1 | |
| buy: 9 | |
| finally: 19 | |
| whenever: 14 | |
| regulation: 2 |
This file contains hidden or 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
| #ifndef VECT_H | |
| #define VECT_H | |
| /* | |
| * vect.h -- type-safe generic dynamic array | |
| * made by sixthgear. BSD Licenced. | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> |
This file contains hidden or 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
| #include "hash.h" | |
| table * | |
| ht_init(int num, size_t type_size, int key_len, void *hf, void *pf) | |
| { | |
| size_t total_size; | |
| total_size = sizeof(table); /* table */ | |
| total_size += sizeof(char) * num * key_len; /* keys */ | |
| total_size += (type_size * num); /* values */ | |
| table *ht = malloc(total_size); |
This file contains hidden or 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 | |
| """ | |
| Usage: ./fxuy.py [f] [u] | |
| Example: ./fxuy.py 7 12 | |
| Requires: banner or printerbanner | |
| """ | |
| import os | |
| import sys | |
| import subprocess |
This file contains hidden or 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 itertools | |
| import fractions | |
| def roll(faces, dice, keep): | |
| results = {} | |
| denom = faces ** dice | |
| for roll in itertools.product(*[range(1,faces+1) for d in range(dice)]): | |
| r = sum(sorted(roll, reverse=True)[:keep]) | |
| if not results.has_key(r): results[r] = fractions.Fraction(1, denom) |
This file contains hidden or 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
| var events = []; | |
| var intervals = []; | |
| var max_id = 0; | |
| function setInterval(callback, period) { | |
| intervals.push(new Interval(callback, period)); | |
| return ++max_id; | |
| } | |
| function clearInterval(id) { |