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 (term? expr) | |
(or (symbol? expr) (number? expr))) | |
(define/match (expr? expr) | |
[((list (or '+ '- '*) (? expr?) ...)) #t] | |
[((? term?)) #t] | |
[(_) #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
import abc | |
import copy | |
from collections import defaultdict | |
from pprint import pprint | |
from typing import ( | |
Any, | |
Callable, | |
Dict, | |
Hashable, |
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
night_owl total night_owl_perc | |
0 422315 2541639 0.166159 |
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
con = ibis.bigquery.connect(billing_project, 'bigquery-public-data.samples') | |
t = con.table('github_nested') | |
expr = ( | |
t.mutate( | |
# get the hour in UTC during which a repo was created | |
hour=lambda t: t.created_at | |
.to_timestamp('%Y/%m/%d %T %z') | |
.hour(), | |
# compute the UTC offset to adjust in the next expression | |
utc_offset=lambda t: t.created_at.split(' ')[2].cast('int64') // 100) |
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
SELECT *, | |
acq_ipos / num_investments AS acq_rate | |
FROM ( | |
SELECT CASE WHEN i.investor_name IS NULL THEN ‘NO INVESTOR’ | |
ELSE i.investor_name | |
END AS “Investor name”, | |
COUNT(DISTINCT c.permalink) AS num_investments, | |
COUNT(DISTINCT | |
CASE WHEN c.status IN (‘ipo’, ‘acquired’) THEN c.permalink | |
END) AS acq_ipos |
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 | |
set -eo pipefail | |
function env_exists() { | |
conda env list | cut -d ' ' -f 1 | grep -v '#' | grep "${1}" 1> /dev/null | |
} | |
envname="skimage-test-opt" |
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 pandas as pd | |
import ibis | |
import click | |
from prompt_toolkit import prompt | |
from prompt_toolkit.layout.lexers import PygmentsLexer | |
from pygments.lexers.sql import PostgresLexer | |
@click.command() |
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 random | |
import time | |
from collections import deque | |
from threading import Thread | |
import zmq | |
import numpy as np | |
import pandas as pd |
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
In [6]: from slumba.miniast import * | |
In [7]: from slumba.source import sourcify | |
In [8]: myfunc = def_.silly_func(arg.a)( | |
...: if_( | |
...: load.a == 1, | |
...: return_(load.a + 2), | |
...: return_('Foo') | |
...: ) |
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 random | |
import time | |
from collections import deque | |
from threading import Thread | |
import zmq | |
import numpy as np | |
import pandas as pd |