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
from IPython.display import display | |
import pandas as pd | |
def pdshow(df): | |
""" | |
This shows a pandas dataframe in full/ | |
Also consider .to_html() and https://pbpython.com/dataframe-gui-overview.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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
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
#!/bin/bash | |
TEMPFILE='/tmp/restic_ignores.txt' | |
BACKUPDIR=$HOME | |
# Note: Not sure which way is better, echo nothing into the file, or remove if exists | |
# if [ -f $TEMPFILE ]; then | |
# rm $TEMPFILE | |
# fi | |
# touch $TEMPFILE |
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
# This is an example PKGBUILD file. Use this as a start to creating your own, | |
# and remove these comments. For more information, see 'man PKGBUILD'. | |
# NOTE: Please fill out the license field for your package! If it is unknown, | |
# then please put 'unknown'. | |
# Maintainer: Your Name <[email protected]> | |
pkgname=NAME | |
pkgver=VERSION | |
pkgrel=1 | |
epoch= |
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
#!/bin/bash | |
USER=${1:-sebble} | |
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-) | |
PAGES=$((658/100+1)) | |
echo You have $STARS starred repositories. | |
echo |
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
# List unique values in a DataFrame column | |
df['Column Name'].unique() | |
# convert column to lowercase (without warning working on copy) | |
df.loc[:, 'url'] = df.loc[:, 'url'].str.lower() | |
# To extract a specific column (subset the dataframe), you can use [ ] (brackets) or attribute notation. | |
df.height | |
df['height'] | |
# are same thing!!! (from http://www.stephaniehicks.com/learnPython/pages/pandas.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
""" | |
If you often use interactive IPython sessions or Jupyter Notebooks and you’re getting tired of importing the same libraries over and over, try this: | |
Navigate to ~/.ipython/profile_default | |
Create a folder called startup if it’s not already there | |
Add a new Python file called start.py | |
Put your favorite imports in this file | |
Launch IPython or a Jupyter Notebook and your favorite libraries will be automatically loaded every time! | |
author: Will Koehrsen |
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
import os | |
import pwd | |
import psutil | |
import re | |
import string | |
import requests | |
import socket | |
import argparse | |
import tabulate | |
import pandas as pd |