Skip to content

Instantly share code, notes, and snippets.

View dlovell's full-sized avatar

Dan Lovell dlovell

  • New York, NY
View GitHub Profile
@dlovell
dlovell / dbg-nix-pkg.sh
Last active May 10, 2024 18:05
A helper function to `nix develop` on a package
# https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages#Using_nix-shell_for_package_development
function debug_nix_package () {
set -u
packageName=${1:-default}
flakeDir=${2:-$(pwd)}
tmpdir=${3:-$(mktemp --directory --suffix=-nix-dbg)}
system=${4:-$(uname --machine)-$(uname --kernel-name | tr '[:upper:]' '[:lower:]')}
cd "$tmpdir" || exit
ln -s "$flakeDir" flakeDir
import pyarrow
import pyarrow.compute
import datafusion
from datafusion import (
col,
udaf,
Accumulator,
SessionContext,
)
import datafusion.functions as F
_github_issue_721_completion() {
local IFS=$'
'
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_GITHUB_ISSUE_721_COMPLETE=complete $1 ) )
return 0
}
complete -F _github_issue_721_completion -o default github_issue_721;
import io
import os
import tempfile
import functools
import contextlib
import subprocess
import concurrent.futures
handle_stdout = functools.partial(print, '1:',)
x = 1
@dlovell
dlovell / source_recorder.py
Created January 7, 2018 20:11
Attach function/module source on import via a decorator
"""Attach function/module source on import via a decorator
"""
import sys
import inspect
SOURCE = '_source'
Invoked with :
--ncalls: 3
--repeats: 3
---------------------------------------------------------
Test name | #0 |
---------------------------------------------------------
groupby_multi_different_functions | 9.0636 |
groupby_frame_apply_overhead | 8.3746 |
@dlovell
dlovell / gropuby.py
Created September 28, 2014 12:19
Programmatic creation of vbench Bechmarks for use in pandas testing large ngroups values
from vbench.api import Benchmark
from datetime import datetime
common_setup = """from pandas_vb_common import *
"""
setup = common_setup + """
np.random.seed(1234)
ngroups = 100
# http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion
# sudo apt-get install subversion git-svn
set -euv
function create_local_svn_copy {
local svn_dir=$1
local svn_url=$2
#
pre_revprop_change_file=$svn_dir/hooks/pre-revprop-change
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1