-
Inject profiling code
At the beginning of your .zshrc add following:
zmodload zsh/zprof
and at the end add:
zprof
This will load zprof mod and display what your shell was doing durung your initialization.
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 numpy as np | |
def makeMixedDataFrame(): | |
return pd.DataFrame( | |
{ | |
"A": [0.0, 1.0, 2.0, 3.0, 4.0], | |
"B": [0.0, 1.0, 0.0, 1.0, 0.0], | |
"C": pd.Index(["foo1", "foo2", "foo3", "foo4", "foo5"], dtype=object), | |
"D": pd.date_range("20130101", periods=5), |
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
# On slow systems, checking the cached .zcompdump file to see if it must be | |
# regenerated adds a noticable delay to zsh startup. This little hack restricts | |
# it to once a day. It should be pasted into your own completion file. | |
# | |
# The globbing is a little complicated here: | |
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct. | |
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error) | |
# - '.' matches "regular files" | |
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours. | |
autoload -Uz compinit |
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
function validateType(expected, input) { | |
if (!input) return false; | |
// maps verifications for standard types and custom classes | |
const typeVerifier = { | |
Object: (x) => typeof x === 'object' && | |
!Array.isArray(x) && | |
x !== null, | |
String: (x) => typeof x === 'string', | |
Number: (x) => typeof x === 'number', |
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 datetime | |
from datetime import datetime as dt | |
from dateutil.relativedelta import * | |
class TimeBasedCV(object): | |
''' | |
Parameters | |
---------- | |
train_period: int |
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
def get_feature_names(column_transformer): | |
"""Get feature names from all transformers. | |
Returns | |
------- | |
feature_names : list of strings | |
Names of the features produced by transform. | |
""" | |
# Remove the internal helper function | |
#check_is_fitted(column_transformer) | |
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 | |
grep_output=$(grep --color=always -E '^.*(breakpoint|set_trace)\(\)' -H -n -R -I -o --include="*.py") | |
[ $grep_output ] \ | |
&& echo 'Found breakpoint or set_trace in your code.' \ | |
&& echo "$grep_output"\ | |
&& exit 1 \ | |
|| exit 0 |
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
//When you copy a file from an external drive onto linux, the files gets weird permissions and gets colored differently by your standard `ls` std outupt. | |
//This changes the permissions so that it degreens it. | |
function degreen() { | |
chmod -R a-x,o-w,+ $@ | |
} |
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
function psgrep() { ps axuf | grep -v grep | grep "$@" -i --color=auto; } |
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 | |
from functools import reduce | |
def crossing(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame: | |
""" | |
Returns a data frame with the cross product (every pair possible) of rows | |
between df1 and df2 | |
""" | |
df1["join_key"] = 0 | |
df2["join_key"] = 0 |
NewerOlder