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 math | |
import fontPens.marginPen | |
import fontTools.designspaceLib | |
import fontTools.feaLib.parser | |
import ufoLib2 | |
DOT_BELOW_Y_MAX = -50 | |
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
\documentclass[letterpaper,draft,11pt]{memoir} | |
\pdfvariable minorversion=7 | |
\usepackage{fontspec} | |
\usepackage{microtype} | |
\input{ushyphex} | |
\defaultfontfeatures{Scale=MatchLowercase} | |
\setmainfont{TeX Gyre Pagella} |
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
diff --git a/kernel-2018/arch/arm/boot/dts/imx6sll-ntx.dtsi b/kernel-2021/arch/arm/boot/dts/imx6sll-ntx.dtsi | |
index 5121ada..f6c7d09 100644 | |
--- a/kernel-2018/arch/arm/boot/dts/imx6sll-ntx.dtsi | |
+++ b/kernel-2021/arch/arm/boot/dts/imx6sll-ntx.dtsi | |
@@ -52,15 +52,15 @@ | |
operating-points = < /* Core2_1V3_ARM */ | |
/* kHz uV */ | |
996000 1275000 | |
- 792000 1175000 | |
- 396000 1175000 |
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 base64 | |
import json | |
def extract_jwt_claims(req): | |
header = req.headers.get('X-Endpoint-API-UserInfo') | |
if header is None: | |
return None | |
val = json.loads(base64.urlsafe_b64decode(header)) | |
claims_json = val['claims'] | |
claims = json.loads(claims_json) |
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
# Assume these classes are fully defined, including relationships | |
class User(Base): | |
pass | |
class Order(Base): | |
pass | |
# Requested: SELECT DISTINCT user.id FROM user, order WHERE user.id = order.user_id | |
session.query(User.id).select_from(User, Order).filter(User.id == Order.user_id).distinct() | |
# Produces: SELECT DISTINCT user.id AS user_id FROM user, order WHERE user.id = order.user_id |
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 sqlalchemy.types import DATETIME # optionally import this from your specific dialect | |
from sqlalchemy.types import TypeDecorator | |
import datetime | |
import pytz | |
class TzDateTime(TypeDecorator): | |
impl = DATETIME | |
tz = pytz.utc | |
def process_bind_param(self, value, dialect): |
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
(defvar *client* | |
(make-instance | |
'north:client | |
:key "key" | |
:secret "secret" | |
:token "token" | |
:token-secret "secret" | |
:request-token-uri "https://www.tumblr.com/oauth/request_token" | |
:authorize-uri "https://www.tumblr.com/oauth/authorize" | |
:access-token-uri "https://www.tumblr.com/oauth/access_token")) |
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 sqlalchemy import inspect | |
from sqlalchemy.orm import joinedload | |
def reload_eagerly(obj, *rels): | |
state = inspect(obj) | |
if not state.persistent: | |
raise ValueError("reload_eagerly can only be used on persistent objects") | |
query = state.session.query(state.mapper).filter(*[col == val for col, val in zip(state.mapper.primary_key, state.identity)]) | |
for rel in rels: | |
if rel in state.mapper.all_orm_descriptors: |
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 pyramid.config import Configurator | |
from pyramid.session import SignedCookieSessionFactory | |
from pyramid.authentication import SessionAuthenticationPolicy | |
from pyramid.authorization import ACLAuthorizationPolicy | |
from pyramid.security import Allow, Authenticated, Everyone | |
class Public(object): | |
__acl__ = [(Allow, Everyone, 'view')] |
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 graphviz | |
import pkg_resources | |
pkg_keys = {} | |
for item in pkg_resources.working_set: | |
r = item.as_requirement() | |
pkg_keys[r.key] = r.project_name | |
depends = {} | |
for item in pkg_resources.working_set: | |
depends[item.as_requirement().key] = [r.key for r in item.requires()] |
NewerOlder