Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import requests
import pandas as pd
import os
import subprocess
from io import StringIO
def get_keychain_password(account, service):
"""
import requests
import pandas as pd
import os
import subprocess
from io import StringIO
def get_keychain_password(account, service):
"""
Fetch a password from the macOS Keychain.
:param account: The account name associated with the password.
@jayers99
jayers99 / pyenv_snippets.sh
Last active September 3, 2021 22:57
pyenv
# links
# https://github.com/pyenv/pyenv
# test box
ssh ubuntu2004
# install prereqs
sudo su -
apt update
apt-get update
# The git prompt's git commands are read-only and should not interfere with
# other processes. This environment variable is equivalent to running with `git
# --no-optional-locks`, but falls back gracefully for older versions of git.
# See git(1) for and git-status(1) for a description of that flag.
#
# We wrap in a local function instead of exporting the variable directly in
# order to avoid interfering with manually-run git commands by the user.
function __git_prompt_git() {
GIT_OPTIONAL_LOCKS=0 command git "$@"
}
@jayers99
jayers99 / prompt.zsh
Last active March 18, 2021 23:15
zsh prompt with out oh-my-zsh
# setup for prompt
autoload colors; colors;
export LSCOLORS=ExFxBxDxCxegedabagacad
# export LSCOLORS="Gxfxcxdxbxegedabagacad"
setopt prompt_subst
# prompt
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}%{$fg[blue]%}(%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[blue]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
@jayers99
jayers99 / jq-csv.sh
Created September 19, 2019 20:41
jg fun
jq -r '.data[] | "\(.id), \(.attributes.name)"'
@jayers99
jayers99 / tear.sh
Created August 26, 2019 17:40
print a line all the way across the screen to separate sections of output
# tear will print a line across the screen to sperate the output
function tear {
printf -vl "%${COLUMNS:-`tput cols 2>&-||echo 80`}s\n" && echo $'\e[1;33m'${l// /-}$'\e[0m';
}
@jayers99
jayers99 / snipit.sh
Last active June 26, 2019 23:56
copy the last command to a file
snipit() {
[ ! -z "${1}" ] && snip_file="${1}" || snip_file='snippets.sh'
echo "" >> $snip_file
read -p "Enter comment: " comment
[ ! -z "${comment}" ] && echo "# ${comment}" >> $snip_file
fc -ln -1 | sed '1s/^[[:space:]]*//' >> $snip_file
[ ! -z "${comment}" ] && tail -n 2 $snip_file || tail -n 1 $snip_file
}
@jayers99
jayers99 / .sshconfig
Created May 8, 2019 21:52
ssh config
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 120
TCPKeepAlive yes
ForwardAgent yes