Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / bootstrap.sh
Last active September 1, 2023 02:15
Working ubuntu cloud-config used with multipass
multipass launch -n testvm -mem --cpu 1 --disk 5G --memory 2G 22.04 --cloud-init ~/.config/cloud-init.yml -v
ip_addr=$(multipass info testvm | awk '/IPv4/ {print $NF}')
ssh "ubuntu@${ip_addr}"
@pythoninthegrass
pythoninthegrass / clean_code.md
Created May 24, 2022 04:55 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@pythoninthegrass
pythoninthegrass / get-oauth2-token-meetup-api
Created May 4, 2022 07:03 — forked from valeriocos/get-oauth2-token-meetup-api
Get a bearer/OAuth2 token for Meetup application-only requests in Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@pythoninthegrass
pythoninthegrass / articles.json
Created April 17, 2022 02:39
Svelte REPL troubleshooting
{"1":{"title":"USFL 2022 season opener, New Jersey Generals at Birmingham Stallions: Live updates, score, TV, streaming info - CBS Sports","url":"https://www.cbssports.com/general/news/usfl-2022-season-opener-new-jersey-generals-at-birmingham-stallions-live-updates-score-tv-streaming-info/live/","source":"CBS Sports"},"2":{"title":"2022 NBA Playoffs - Betting Tips for Saturday's Game 1 matchups - ESPN","url":"https://www.espn.com/chalk/story/_/id/33746620/2022-nba-playoffs-betting-tips-saturday-game-1-matchups","source":"ESPN"},"3":{"title":"Here's what Biden, Harris and their spouses paid in 2021 taxes - CBS News","url":"https://www.cbsnews.com/news/heres-what-the-president-vice-president-and-their-spouses-earned-and-paid-in-taxes-in-2021/","source":"CBS News"},"4":{"title":"Judge rules Musk's tweets over taking Tesla private were false, investors say - Reuters","url":"https://www.reuters.com/business/autos-transportation/judge-rules-musks-tweets-over-taking-tesla-private-were-false-investors-say-2022-04-16/
@pythoninthegrass
pythoninthegrass / nm_scan.py
Created April 13, 2022 16:06
Ingest CSVs from Cisco Meraki, then filter by IP address, and scan the hosts from the filtered CSV
#!/usr/bin/env python3
import nmap
import pandas as pd
from icecream import ic
from pathlib import Path
# verbose icecream
# ic.configureOutput(includeContext=True)
@pythoninthegrass
pythoninthegrass / config
Created March 19, 2022 02:15 — forked from miguelmota/config
Arch linux VNC server setup
session=lxqt
geometry=1920x1080
localhost # comment this out to allow connections from anywhere
alwaysshared
@pythoninthegrass
pythoninthegrass / main.yml
Created February 22, 2022 05:21
Send submodule updates to parent repo
name: Send submodule updates to parent repo
on:
push:
branches:
- main
- master
jobs:
update:
@pythoninthegrass
pythoninthegrass / .bash_aliases
Last active November 30, 2026 03:48
Bash shell config (~/.bashrc) for Intel and ARM Macs
# shellcheck disable=all
# homebrew — init early so brew tools (envsubst, etc.) are on PATH for all blocks below
[[ -f "/opt/homebrew/bin/brew" ]] && eval "$(/opt/homebrew/bin/brew shellenv)"
[[ -f "/home/linuxbrew/.linuxbrew/bin/brew" ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# bun — init early so check_bin opencode finds it before the alias block
[[ -d "$HOME/.bun/bin" ]] && export PATH="$HOME/.bun/bin:$PATH"
# PATH
@pythoninthegrass
pythoninthegrass / beautiful_idiomatic_python.md
Created January 28, 2022 22:03 — forked from 0x4D31/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: