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
#!/usr/bin/python | |
import select, array, fcntl | |
fname = '/dev/wilco_ec' | |
with open(fname, "r+") as file: | |
p = select.poll() | |
p.register(file.fileno(), select.POLLIN) | |
events = p.poll(100) | |
print "result of poll: ", events |
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
#!/usr/bin/python | |
import select, array, os | |
fname = "/dev/wilco_event" | |
with open(fname, "r+") as fd: | |
p = select.poll() | |
p.register(fd.fileno(), select.POLLIN) | |
events = p.poll(100) |
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
#!/usr/bin/python │ CC firmware/2lib/2secdatak.o | |
│ CC firmware/2lib/2sha1.o | |
import select, os, glob │ CC firmware/2lib/2sha256.o | |
│ CC firmware/2lib/2sha512.o | |
fname = glob.glob("/dev/wilco_event*")[0] │ CC firmware/2lib/2sha_utility.o | |
│ CC firmware/2lib/2tpm_boot |
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
#!/usr/bin/python | |
# https://gist.github.com/NickCrews/52ab07c8519b56c0ec671d3338760516 | |
import os, glob | |
def test(bytes): | |
fname = glob.glob("/dev/wilco_telem*")[0] | |
fd = None |
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
function filtered = gaussianFilter(img, sigma, varargin) | |
% GAUSSIANFILTER Simplified open-source version of IMGAUSSFILT | |
% The IMGAUSSFILT function is part of the Image Processing Toolbox, | |
% but if you don't want to install that, then use this | |
% instead. I haven't actually tested this to ensure it gives the same result. | |
% Inspired by https://stackoverflow.com/questions/13193248/how-to-make-a-gaussian-filter-in-matlab | |
% | |
% Hardcodes in the default arguments of IMGAUSSFILT | |
% (per https://www.mathworks.com/help/images/ref/imgaussfilt.html) |
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
# Useful for mounting a .img file (eg for a raspberrypi OS image | |
# so you can modify the root or boot filesystems). | |
if [ -z "$1" ] ; then | |
echo "usage: $0 IMG_FILE MOUNT_POINT PARTITION_NUMBER" | |
exit 1 | |
fi | |
IMG_FILE=$1 | |
if [ -z "$2" ] ; then |
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
YEAR | Make | Model | Size | (kW) | Unnamed: 5 | TYPE | CITY (kWh/100 km) | HWY (kWh/100 km) | COMB (kWh/100 km) | CITY (Le/100 km) | HWY (Le/100 km) | COMB (Le/100 km) | (g/km) | RATING | (km) | TIME (h) | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 | MITSUBISHI | i-MiEV | SUBCOMPACT | 49 | A1 | B | 16.9 | 21.4 | 18.7 | 1.9 | 2.4 | 2.1 | 0 | 100 | 7 | ||
2112 | NISSAN | LEAF | MID-SIZE | A1 | B | 19.3 | 23.0 | 21.1 | 2.2 | 2.6 | 2.4 | 0 | 117 | 7 | |||
2113 | FORD | FOCUS ELECTRIC | COMPACT | 107 | A1 | B | 19.0 | 21.1 | 20.0 | 2.1 | 2.4 | 2.2 | 0 | 122 | 4 | ||
"2013" | MITSUBISHI | i-MiEV | SUBCOMPACT | 49 | A1 | B | 16.9 | 21.4 | 18.7 | 1.9 | 2.4 | 2.1 | 0 | 100 | 7 | ||
2013 | NISSAN | LEAF | MID-SIZE | 80 | A1 | B | 19.3 | 23.0 | 21.1 | 2.2 | 2.6 | 2.4 | 0 | 117 | 7 | ||
2013 | SMART | FORTWO ELECTRIC DRIVE CABRIOLET | TWO-SEATER | 35 | A1 | B | 17.2 | 22.5 | 19.6 | 1.9 | 2.5 | 2.2 | 0 | 109 | 8 | ||
2013 | SMART | FORTWO ELECTRIC DRIVE COUPE | TWO-SEATER | 35 | A1 | B | 17.2 | 19.6 | 1.9 | 2.5 | 2.2 | 0 | 109 | 8 | |||
2013 | TESLA | MODEL S (40 kWh battery) | FULL-SIZE | 270 | A1 | B | 22.4 | 21.9 | 22.2 | 2.5 | 2.5 | 2.5 | 0 | 224 | 6 | ||
2013 | TESLA | MODEL S (60 kWh battery) | FULL-SIZE | 270 | A1 | B | 22.2 | 21.7 | 21.9 | 2.5 | 2.4 | 2.5 | 0 | 335 | 10 |
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
"""coalesce_parquets.py | |
gist of how to coalesce small row groups into larger row groups. | |
Solves the problem described in https://issues.apache.org/jira/browse/PARQUET-1115 | |
""" | |
from __future__ import annotations | |
from pathlib import Path | |
from typing import Callable, Iterable, TypeVar |
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
AnyColOrTable = TypeVar("AnyColOrTable", Column, Table, pd.Series, pd.DataFrame) | |
def convert_to_ibis( | |
func: Callable[[ColOrTable], ColOrTable] | |
) -> Callable[[AnyColOrTable], AnyColOrTable]: | |
"""Decorator that translates pandas series to Columns and DFs to Tables, | |
applies the function, and then converts back to pandas.""" | |
@functools.wraps(func) |
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
"""Get the Facebook page IDs for a set of facebook URLs. | |
Uses Playwright to emulate me going to the page and looking at the page ID in the | |
actual HTML. I haven't found a more programmatic way to do this without | |
more complicated developer signup and API keys. | |
Uses cookies for authentication, as described in | |
https://github.com/kevinzg/facebook-scraper/blob/392be1eabb43ed301fb7d5c3fd6e10318d26ac27/README.md | |
""" | |
from __future__ import annotations |
OlderNewer