Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View maksbotan's full-sized avatar

Maxim Koltsov maksbotan

View GitHub Profile
@maksbotan
maksbotan / Groebner.hs
Created April 18, 2013 18:04
Source code for Groebner bases implementation in Haskell
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
(define (empty_list selector)
(selector '() '() #t)
)
(define (prepend el lst)
(lambda (selector)
(selector el lst #f)
)
)
#!/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=""):
#!/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=""):
#!/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=""):
@maksbotan
maksbotan / gist:2587517
Created May 3, 2012 17:40
Minimal test case for github auth api
>>> 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