This file contains 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
#[macro_use] | |
extern crate serde_derive; | |
extern crate toml; | |
use std::borrow::Cow; | |
use std::fs::File; | |
use std::io::Read; | |
#[derive(Debug, Serialize, Deserialize)] | |
pub struct Config<'a> { |
This file contains 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
#!/bin/sh | |
curl https://hackage.haskell.org/package/Chart-1.1/docs/Control-Lens-Operators.html | python -c ' | |
import re, sys | |
for line in sys.stdin.readlines(): | |
m = re.search(r"""class="def">([^<]+)</a> ::""", line) | |
if m: | |
print(m.group(1)[1:-1].replace("<", "<").replace("&", "&").replace(">", ">")) | |
' | sort | uniq | wc -l |
This file contains 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
#!/bin/sh | |
# Script for setting up virtualenv to work correctly with Google App Engine projects | |
# @author Karol Kuczmarski "Xion" | |
DEFAULT_APPENGINE_SDK_PATH="/opt/google_appengine" | |
DEFAULT_PROJECT_LIB_PATH="./lib" | |
This file contains 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
""" | |
Jinja extension adding support for {% error %} tag | |
that allows to raise exceptions directly from templates. | |
""" | |
from jinja2 import TemplateAssertionError | |
from jinja2.ext import Extension | |
from jinja2.nodes import CallBlock, Const | |
class ErrorExtension(Extension): |
This file contains 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
from collections import Mapping | |
import unittest | |
import warnings | |
from flask import get_template_attribute | |
from myapplication import app | |
class JinjaTestCase(unittest.TestCase): |
This file contains 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 hook extending pytz package with usable, generic timezones: | |
GMT-14 up to GMT+12. | |
Note that pytz already has Etc/GMT+X timezones, but | |
(quoting Wikipedia): | |
"In order to conform with the POSIX style, those zones beginning with "Etc/GMT" | |
have their sign reversed from what most people expect. In this style, | |
zones west of GMT have a positive sign and those east have a negative sign." |
This file contains 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
#:kivy 1.4.1 | |
<Ball>: | |
size: 25, 25 | |
canvas: | |
Color: | |
rgb: 1, 0, 1 | |
Ellipse: | |
pos: self.pos | |
size: self.size |
This file contains 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
""" | |
Module implementing an enhanced string column type for SQLAlchemy | |
with a support for regular expression operators in Postgres and SQLite. | |
""" | |
import re | |
from sqlalchemy import String as _String, event, exc | |
from sqlalchemy.engine import Engine | |
from sqlalchemy.ext.compiler import compiles | |
from sqlalchemy.sql.expression import BinaryExpression, func, literal |
This file contains 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 imp | |
import inspect | |
import sys | |
__all__ = [] | |
class PassthroughImporter(object): | |
"""Import hook that simulates the standard import flow |
This file contains 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
""" | |
Example function that reads a file and does something with it. | |
""" | |
import re | |
import sys | |
def list_shell_aliases(script): | |
"""Find all command aliases defined in a shell script. | |
Aliases are created though the ``alias`` command:: |