Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mike Fiedler miketheman

🏠
Working from home
View GitHub Profile
@miketheman
miketheman / my_package.py
Last active Mar 20, 2021 — forked from benkehoe/my_package.py
Single sourcing a python package version using importlib.metadata.version()
View my_package.py
try:
# importlib.metadata is present in Python 3.8 and later
import importlib.metadata as importlib_metadata
except ImportError:
# use the shim package importlib-metadata pre-3.8
import importlib_metadata as importlib_metadata
try:
__version__ = importlib_metadata.version(__package__ or __name__)
except importlib_metadata.PackageNotFoundError:
View hypermail.rb
class Hypermail < Formula
desc "Hypermail is a free (GPL) program to convert email from Unix mbox format to html."
homepage "http://www.hypermail-project.org/"
url "https://github.com/hypermail-project/hypermail/releases/download/v2.4.0/hypermail-2.4.0.tar.gz"
sha256 "f97995b9bb1ece888968467cdad05e3daa7662ff3e3a5739e378b4f3adeb26c6"
license "GPL-2.0"
depends_on "bison" => :build
depends_on "gcc"
View main.dart
flip(inputInt) {
return inputInt = 1 - inputInt;
}
void main() {
print(flip(0));
print(flip(1));
}
@miketheman
miketheman / _how_to.md
Last active Jun 4, 2020
Mike's Super Janky Manual GitHub Vuln Alert Query
View _how_to.md

How To

Prerequsites:

  • GitHub account with admin-level rights to repos, possibly even org-level admin.
  • Command Line familiarity
  • jq tool

Note: Commands have been written assuming a macOS machine, they may work on other platforms, but I haven't tested those.

@miketheman
miketheman / enable_alerting.py
Created Feb 14, 2020
A simple script to enable GitHub's Data Services & Vulnerability Scanning on a given Organization's Repositories
View enable_alerting.py
from github import Github
gh = Github('SET_GITHUB_ACCESS_TOKE_HERE')
org = gh.get_organization('SET_ORG_NAME_HERE')
repos = org.get_repos()
for repo in repos:
if repo.archived:
@miketheman
miketheman / main.dart
Last active Jan 18, 2020
round duration to closer second, for a countdown clock - https://dartpad.dartlang.org/2a08161c5f889e018938316237c0e810
View main.dart
void main() {
Duration duration = new Duration(minutes: 1, seconds: 59, milliseconds: 99);
print(secondRounder(duration));
}
// Rounds Duration to seconds based on milliseconds
// This is semi-equivalent to a non-existing `Duration.ceil(milliseconds)`
Duration secondRounder(Duration duration) {
int roundedDuration;
@miketheman
miketheman / datadog-agent-pi-setup.sh
Last active Sep 2, 2018
Datadog Agent 5.x Service on Raspberry Pi
View datadog-agent-pi-setup.sh
DD_API_KEY=<REPLACE> sh -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/setup_agent.sh)"
sudo mkdir /opt/datadog-agent
sudo cp -r ~/.datadog-agent/* /opt/datadog-agent
path=$HOME
path=${path//\//\\\/}
sedcmd="s/$path\/.datadog-agent/\/opt\/datadog-agent/g"
for i in /opt/datadog-agent/venv/bin/*; do echo $i; sudo sed -i $sedcmd $i; done
@miketheman
miketheman / console
Created Sep 21, 2017
core/gmp multiple versions
View console
★ Install of core/readline/6.3.8/20170513213506 complete with 0 new packages installed.
guile: Resolved dependency 'core/readline' to /hab/pkgs/core/readline/6.3.8/20170513213506
guile: WARN
guile: WARN The following runtime dependencies have more than one version
guile: WARN release in the full dependency chain:
guile: WARN
guile: WARN * core/gmp ( core/gmp/6.1.2/20170526062114 core/gmp/6.1.0/20170513202112 )
guile: WARN
guile: WARN The current situation usually arises when a Plan has a direct
guile: WARN dependency on one version of a package (`acme/A/7.0/20160101200001`)
@miketheman
miketheman / console.sh-session
Created Dec 25, 2016
Crystal Lang 0.20.3 Socket::IPAddress change
View console.sh-session
$ crystal --version
Crystal 0.20.1 (2016-12-05)
$ crystal run test.cr
1482659875.246: 127.0.0.1:55157 "This is only a test."
$ crystal --version
Crystal 0.20.3 (2016-12-23)
$ crystal run test.cr
Error in test.cr:10: wrong number of arguments for 'Socket::IPAddress.new' (given 3, expected 2)
Overloads are:
@miketheman
miketheman / Makefile
Created Sep 1, 2016
Django + docker-compose Makefile
View Makefile
CURRENT_DIRECTORY := $(shell pwd)
TESTSCOPE = apps
TESTFLAGS = --with-timer --timer-top-n 10 --keepdb
help:
@echo "Docker Compose Help"
@echo "-----------------------"
@echo ""
@echo "Run tests to ensure current state is good:"