Skip to content

Instantly share code, notes, and snippets.

View jakebrinkmann's full-sized avatar

Jake Brinkmann jakebrinkmann

View GitHub Profile
@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@jakebrinkmann
jakebrinkmann / aftv.sh
Last active April 25, 2024 01:16
HTPC (Home Theater PC), Batocera, Lakka Configs (retroarch, xclip -selection clipboard -i, Kodi, libreelec.tv,)
type adb &>/dev/null
adb --version
adb kill-server
adb start-server
# connect via usb
adb devices
adb tcpip 5555
@jakebrinkmann
jakebrinkmann / .flake8
Last active April 22, 2024 13:42
Using the Python poetry tool to manage dependencies of an AWS Serverless (AWS-SAM-CLI) project.
##### https://flake8.pycqa.org/en/latest/user/configuration.html
[flake8]
ignore =
# D100: Missing docstring at top of file
D100,
# D104: Missing docstring in __init__.py
D104,
# D401: Docstring first line should be imperative
D401,
# D101 Missing docstring in public class
text = input("Enter text: ")
# The list of fonts. Add your font here.
print("┌───────────────────────┬─────────────────────────────────────────────────────────────────────────────────────┐")
print("│ Font │ Characters │▒▒")
print("├───────────────────────┼─────────────────────────────────────────────────────────────────────────────────────┤▒▒")
print("│1 Bold │ 𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵")
print("│2 Italic │ 𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫")
print("│3 Bold Italic │ 𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕𝙖𝙗𝙘𝙙𝙚𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢𝙣𝙤𝙥𝙦𝙧𝙨𝙩𝙪𝙫𝙬𝙭𝙮𝙯𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵")
@jakebrinkmann
jakebrinkmann / download_m2m.py
Last active April 12, 2024 12:42
Python module for straight-forward EarthExplorer Machine-to-Machine
"""
Data download script for EarthExplorer Machine-to-Machine
download_m2m('/path/to/downloads', username='user1234', dataset='ARD_TILE',
products='TOA,BT,SR,PQA', threads=40,
fields={'Region': 'CU', 'Spacecraft': 'LANDSAT_8'})
More M2M documentation: https://earthexplorer.usgs.gov/inventory/documentation
Author: Jake Brinkmann <jacob.brinkmann.ctr@usgs.gov>
@jakebrinkmann
jakebrinkmann / README.md
Created July 25, 2023 15:26
GitHub special files and paths, such as README, LICENSE, CONTRIBUTING, CODE_OF_CONDUCT

Common special files found in the root directory of a repository

Description for and list of popular special files like README/CHANGELOG/LICENSE and others.

README-like

ReadMe README.md README

The ReadMe is usually the first document people will see of your project. Depending on your project it should give a short introduction and usage/build examples. It should only contain the information you expect users to read. It is usually possible to link to other documentation files using the markdown syntax which gets rendered as html by popular repository hosting platforms.

@jakebrinkmann
jakebrinkmann / remote_sudo.py
Created March 18, 2024 16:57
remote_sudo.py (python, paramiko, ssh, ssh_config)
#!/usr/bin/env python3
"""Remote Sudo (python, paramiko, ssh, ssh_config)"""
import os
import sys
from glob import glob
import paramiko
def remote_sudo(cmd, host, user, passwd, port=22):
@jakebrinkmann
jakebrinkmann / modal.html
Last active March 18, 2024 16:55
js-alpinejs
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@1.2.0/dist/tailwind.min.css">
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@2.8.2/dist/alpine.min.js"
defer crossorigin="anonymous"></script>
</head>
<body class="bg-gray-300 text-gray-800">
<div class="container mx-auto px-4 xl:px-64 mt-12 mb-12">
<h2 class="text-2xl font-bold">Modal</h2>
<!-- NOTE: ADD x-data here -->
#!/usr/bin/env bash
LOG_GROUP_NAME=${1-} # API-ResourceFunction
MY_QUERY="${@:2}"
START_TIME=$(date --date="${START_TIME:-30 minutes ago}" "+%s000")
END_TIME=$(date "+%s000")
if [ -z "${LOG_GROUP_NAME}" ]; then
aws logs describe-log-groups --query 'logGroups[].logGroupName'
exit 0;
@jakebrinkmann
jakebrinkmann / README.md
Last active March 7, 2024 00:13
little-go-book

1. Basics

go version
# go version go1.21.5 darwin/arm64

godoc -http=:6060