Skip to content

Instantly share code, notes, and snippets.

View hernamesbarbara's full-sized avatar

austin hernamesbarbara

View GitHub Profile

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@hernamesbarbara
hernamesbarbara / .bash_profile
Created February 29, 2012 04:59
bash_profile with terminal colors and useful aliases
#!/bin/bash
export TERM=xterm-color
export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
# export LSCOLORS=Exfxcxdxbxegedabagacad
export LSCOLORS=gxfxcxdxbxegedabagacad # Dark lscolor scheme
# Don't put duplicate lines in your bash history
export HISTCONTROL=ignoredups
# increase history limit (100KB or 5K entries)
export HISTFILESIZE=100000
#!/usr/bin/env python3
import pandas as pd
import re
# Input string
email_str = """
Foo Bar <foo@example1.io>, me@example2.com, Alice B. Charlie <charlie@example3.io>, Pete <pete@example4.com>, Sam Fred Webster Clarke <sfwc@example5.net>, john@example6.com
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""excuse.py
Usage:
excuse.py
Arguments:
-h --help
#!/usr/bin/env python3
from datetime import datetime
import objc
from Contacts import (CNMutableContact, CNContactStore, CNSaveRequest, CNLabeledValue,
CNPhoneNumber, CNLabelURLAddressHomePage)
from Foundation import NSCalendar, NSDateComponents
class Contact:
"""
#!/usr/bin/env bash
# split a long mp3 into separate mp3s of equal length
# args:
# <input_mp3>: filename of the long mp3
# <n_parts>: how many shorter mp3s you want to cut the long one into
# ./splitmp3 long-mp3-audio.mp4 3 # -> gives you 3 output mp3s of equal length
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input_mp3> <n_parts>"
exit 1
# -*- coding: utf-8 -*-
import subprocess
import os
# need to install Calibre e-book mgmt tool dependencies
# https://calibre-ebook.com/
# https://www.epubor.com/calibre-drm-removal-plugins.html
def kindle2pdf(kindle_file, output_directory):
"""
convert_webm_to_mp4() {
for file in *.webm; do
if [[ ! -e "$file" ]]; then
echo "No .webm files found in the current directory."
return 1
fi
local newfile="${file/.webm/.mp4}"
@hernamesbarbara
hernamesbarbara / README.md
Created June 8, 2014 19:10
A numpy implementation ~5× faster than using itertools.
@hernamesbarbara
hernamesbarbara / places.py
Created August 31, 2023 23:09
fetch place_ids from google
#!/usr/bin/env python3
import os
import requests
import pandas as pd
ENDPOINTS = {
"/search": {"url": "https://maps.googleapis.com/maps/api/place/findplacefromtext/json", "params": ["input", "inputtype", "fields"]},
"/details": {"url": "https://maps.googleapis.com/maps/api/place/details/json", "params": ["place_id", "fields"]}
}