Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 operator | |
import typing as tp | |
""" | |
a. Structure of Parser | |
p = (s -> Any object) | |
Partially consuming parser | |
p1 = (s -> (a, remaining)) |
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
-- Notes on how to wrap InputT over StateT to maintain the environment around a language repl. | |
type HaskellLineT = InputT (StateT Env IO) () | |
runScriptInteractive = runStateT (runInputT defaultSettings loop) (initEnv Nothing) | |
where | |
loop :: HaskellLineT | |
loop = do | |
minput <- getInputLine "%" | |
when (isNothing minput) loop |
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 typing as tp | |
class Abstract: | |
def func1(self, *, x: int, y: str): | |
raise NotImplementedError() |
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
{-# LANGUAGE GADTs, TypeInType, DataKinds, TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeApplications #-} | |
import GHC.TypeLits | |
import GHC.Types | |
import Data.Singletons | |
import Data.Singletons.Prelude | |
data Format = Lit Symbol | Str | Shown Type |
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
#https://bcb.github.io/airflow/execute-context | |
from airflow.models import TaskInstance | |
ti=TaskInstance(task=t, execution_date=datetime.datetime.now()) | |
ti.get_template_context() |
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
#!/bin/bash | |
export PYTHON_VERSION=3.6.5 | |
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | |
sudo apt update | |
sudo apt install --no-install-recommends -y \ | |
software-properties-common build-essential \ | |
libssl-dev libreadline-dev libbz2-dev libsqlite3-dev zlib1g-dev \ | |
python-minimal |
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
''' | |
Module that can generate revset expressions required by Hg from python function call structures. | |
''' | |
def _wrap(outer_fn, *args): | |
args = args or '' | |
if args: | |
args = ", ".join(args) | |
return '{}({})'.format(outer_fn, args) |
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
Remapping keys | |
https://askubuntu.com/questions/149971/how-do-you-remap-a-key-to-the-caps-lock-key-in-xubuntu | |
sudo vi /etc/default/keyboard | |
then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control. | |
For example, mine looks like |
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
# coding: utf-8 | |
# Python code to demonstrate the Y-combinator using | |
# the working example presented by Jim Weirich. | |
# https://www.infoq.com/presentations/Y-Combinator | |
def demo(): | |
fact_1 = lambda n: 1 if n == 0 else (n * fact_1 (n - 1)) |
NewerOlder