Skip to content

Instantly share code, notes, and snippets.

View gforsyth's full-sized avatar
🐗
Cinghiale

Gil Forsyth gforsyth

🐗
Cinghiale
View GitHub Profile
import sys
from xonsh.imphooks import XonshImportHook
from xonsh.execer import Execer
sys.meta_path.append(XonshImportHook(Execer()))
from tiny_scriptlet import *
def test_xonsh_function():
import ibis
# Need to define a schema for each table in the SQL
catalog = {
"employee": {"first_name": "string", "last_name": "string", "id": "int64"},
}
# SQL to translate
sql = "SELECT *, first_name as first FROM employee WHERE id < 5 ORDER BY id DESC"
[ins] In [1]: import ibis

[ins] In [2]: from ibis import _

[ins] In [3]: con = ibis.duckdb.connect("/home/gil/data/imdb.ddb")

[ins] In [4]: ratings = con.tables.ratings

[ins] In [5]: basics = con.tables.basics

repr

repr should be very fast repr should allow for recreation of the object but this may not be practical

make sure there is no usage of REPR as a lookup key anywhere

fix the ordering (r10 -> r09)

@gforsyth
gforsyth / gist:f3425d6bd37e6f0b68ba46dbf8121efd
Created February 19, 2021 21:55
dask dataframe column selection stacktrace
distributed.worker - WARNING - Compute Failed
Function: subgraph_callable
args: ( id name x y
timestamp
2000-01-01 00:00:00 996 George 0.828987 -0.929548
2000-01-01 00:00:01 1000 Jerry -0.110702 0.714628
2000-01-01 00:00:02 1018 Wendy 0.626610 -0.723174
2000-01-01 00:00:03 998 Norbert -0.249345 0.829807
2000-01-01 00:00:04 983 Patricia -0.614237 0.045530
... ... ... ... ...
@gforsyth
gforsyth / rever.log
Created February 11, 2021 17:48
rever.log
{"activity":"authors","category":"activity-check","message":"Checked activity authors","rev":"432272b5828d5764359778f1c56de584713418eb","timestamp":1612459852.2720895,"version":"check"}
{"activity":"pytest","category":"activity-check","message":"Checked activity pytest","rev":"432272b5828d5764359778f1c56de584713418eb","timestamp":1612459852.2855263,"version":"check"}
{"activity":"appimage","category":"activity-check","message":"Checked activity appimage","rev":"432272b5828d5764359778f1c56de584713418eb","timestamp":1612459852.2950103,"version":"check"}
{"activity":"push_tag","category":"activity-check","message":"Checked activity push_tag","rev":"432272b5828d5764359778f1c56de584713418eb","timestamp":1612459852.6252518,"version":"check"}
{"activity":"ghrelease","category":"activity-check","message":"Checked activity ghrelease","rev":"432272b5828d5764359778f1c56de584713418eb","timestamp":1612459852.7291415,"version":"check"}
{"activity":"sphinx","category":"activity-check","message":"Checked activity sphinx","re
@gforsyth
gforsyth / bio.md
Last active January 28, 2021 17:36

Bio

Gil Forsyth is a Senior Manager of Software Engineering at the Capital One Center for Machine Learning. He followed the common career path of Japanese language specialist -> administrative assistant -> mechanical engineer -> computational fluid dynamicist -> data scientist -> software engineer. Gil contributes to several projects in the PyData ecosystem and is a core maintainer of xonsh and helps maintain dask. He served as the program chair for the Scientific Computing with Python (SciPy) conference from 2016 to 2020.

@gforsyth
gforsyth / conda_grid_search.xsh
Created March 10, 2020 17:54
Conda Grid Search
import json
import tqdm
def run():
a = $(conda search sphinx --json)
VERSIONS = sorted(list(set([entry["version"] for entry in json.loads(a)['sphinx']])))[::-1]
for VERSION in tqdm.tqdm(VERSIONS):
print(f"HORRIBLY CHECKING {VERSION}")

Keybase proof

I hereby claim:

  • I am gforsyth on github.
  • I am gilforsyth (https://keybase.io/gilforsyth) on keybase.
  • I have a public key ASC_l3vid5azgD8zwY3U-zu0W6eNwgPczYf7-RJVNp77_Qo

To claim this, I am signing this object:

### custom keybindings
from prompt_toolkit.keys import Keys
from builtins import events
from prompt_toolkit.filters import Condition, EmacsInsertMode, ViInsertMode
@events.on_post_init
def custom_keys():
handler = __xonsh_shell__.shell.key_bindings_manager.registry.add_binding