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
## [2015-01-12] Challenge #197 [Easy] ISBN Validator | |
## 2015-01-21 15:08 - by Frankie Brogan | |
import strutils, parseopt2, version, strfmt, math, unittest | |
type | |
TISBNKind* = enum | |
ISBN10, ISBN13 | |
TISBN* = object | |
case kind*: TISBNKind | |
of ISBN10: isbn_10*: array[0..9, int] | |
of ISBN13: isbn_13*: array[0..12, int] |
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
( ch202.fs 2015-02-22T19.49 by fbwright ) | |
1024 CONSTANT buffer-size | |
CREATE buffer-in buffer-size CHARS ALLOT | |
CREATE index-in 1 CELLS ALLOT | |
CREATE buffer-out buffer-size 8 / CHARS ALLOT | |
CREATE index-out 1 CELLS ALLOT | |
( Iterates over buffer-in: every 8 cells it pushes a char to ) | |
( buffer-out and increases index-out by 1 ) | |
: parse-buffer ( -- ) 0 index-out ! 0 index-in @ 0 u+do | |
7 i 8 mod - buffer-in i + c@ case |
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
( easter.fs 2015-02-21T18.23 by fbwright ) | |
( An implementation of the Butcher's algorithm ) | |
: easter { year -- year month day } | |
year 19 mod { a } year 100 / { b } year 100 mod { c } | |
19 a * b + b 4 / - 15 + b b 8 + 25 / - 1 + 3 / - 30 mod { d } | |
32 b 4 mod 2 * + c 4 / 2 * + d - c 4 mod - 7 mod { e } | |
d e + 114 + d 11 * a + e 22 * + 451 / 7 * - { f } | |
f 31 mod 1+ ( day ) f 31 / ( month ) year ; | |
: test ( -- ) cr | |
2014 easter . . . cr ( Should be 2014 4 20 ) |
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
( frogue.fs 2015-02-23T09.05 by fbwright ) | |
( A [simple] roguelike in gforth; move the @, collide with # ) | |
( And [comments excluded] fits into a block [1000/1024 B] ) | |
variable &i 64 constant W 16 constant H create _M W H * chars | |
allot 6 constant MS 32 constant MM create _O MS MM * chars allot | |
: U 0 -1 ; : D 0 1 ; : R 1 0 ; : L -1 0 ; : # W * + _M + ; : & | |
MS * _O + ; : b? H 1- mod 0= swap W 1- mod 0= or ; : p? c@ '# <> | |
; : #d 2dup at-xy # c@ emit ; : #n 2dup # -rot b? if '# else bl | |
then swap c! ; : &xy@ & 1+ dup c@ swap 1+ c@ ; : &xy! & 1+ rot | |
over c! 1+ c! ; : &d dup &xy@ at-xy & c@ emit ; : &n &i @ & swap |
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 | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function, division | |
import sys, time | |
if sys.version_info.major < 3: | |
input = raw_input | |
def compress(data): | |
freq = {} | |
for line in data.splitlines(): |
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 | |
# -*- coding: utf-8 -*- | |
#Finally finished! 2014-07-26T16:25, 768 bytes - with interactive prompt | |
# and reading from file | |
#TODO: exception-checking, maybe continuation | |
#Brainfuck in python | |
#Brainfuck instructions: | |
# > increment the data pointer (to point to the next cell to the right). | |
# < decrement the data pointer (to point to the next cell to the left). | |
# + increment (increase by one) the byte at the data pointer. |
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 | |
# -*- coding: utf-8 -*- | |
#by fbWright | |
from __future__ import print_function, division | |
import sys, bs4, requests, os, os.path, json | |
from urllib.parse import urlparse, urljoin | |
from unidecode import unidecode | |
if sys.version_info.major < 3: | |
input = raw_input |
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 | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function, division | |
import sys | |
from time import sleep | |
if sys.version_info.major < 3: | |
input = raw_input | |
#THIS! IS! A! FUCKING! MESS! |
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 | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function, division | |
from contextlib import contextmanager | |
import sys | |
if sys.version_info.major < 3: | |
input = raw_input | |
class CodeGenerator(object): | |
def __init__(self, tab=" "): |
OlderNewer