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 Data.List (intercalate, foldl') | |
data Monom c a = M c [a] deriving (Eq) | |
newtype Polynom c a = P [Monom c a] deriving (Eq) | |
instance (Eq c, Ord a) => Ord (Monom c a) where | |
compare (M _ asl) (M _ asr) = compare asl asr | |
instance (Show a, Show c, Num a, Num c, Eq a, Eq c) => Show (Monom c a) where |
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
(define (empty_list selector) | |
(selector '() '() #t) | |
) | |
(define (prepend el lst) | |
(lambda (selector) | |
(selector el lst #f) | |
) | |
) |
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 | |
import json, urllib2, base64 | |
from xdg import BaseDirectory as basedir | |
from argparse import ArgumentParser | |
import os.path, sys, getpass | |
class AuthError(Exception): pass | |
def pgist_request_helper(uri, data, basic_auth="", auth_token=""): |
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 | |
import json, urllib2, base64 | |
from xdg import BaseDirectory as basedir | |
from argparse import ArgumentParser | |
import os.path, sys, getpass | |
class AuthError(Exception): pass | |
def pgist_request_helper(uri, data, basic_auth="", auth_token=""): |
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 | |
import json, urllib2, base64 | |
from xdg import BaseDirectory as basedir | |
from argparse import ArgumentParser | |
import os.path, sys, getpass | |
class AuthError(Exception): pass | |
def pgist_request_helper(uri, data, basic_auth="", auth_token=""): |
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 json, urllib2 | |
>>> data = {"scopes": ["gist"], "note": "pgist client"} | |
>>> j_req = json.dumps(data) | |
>>> req = urllib2.Request("https://api.github.com", data=j_req) | |
>>> resp = urllib2.urlopen(req) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/usr/lib64/python2.7/urllib2.py", line 126, in urlopen | |
return _opener.open(url, data, timeout) | |
File "/usr/lib64/python2.7/urllib2.py", line 406, in open |
NewerOlder