This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import logging | |
import re | |
import shlex | |
import subprocess | |
import requests | |
from bs4 import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
# Import .ovpn from Windscribe using NetworkManager | |
set -l target $argv[1] | |
set -l creds $argv[2] | |
echo Importing $target using $creds | |
set -l con_name (basename -s .ovpn $target) | |
set -l username (cat $creds | head -n 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
status.py: Display status of resources in the terminal. | |
Requires rich and mctools. Developed on Python 3.10. | |
""" | |
from datetime import datetime | |
import time | |
from string import digits, printable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# --- | |
# k8s-openapi.sh | |
# | |
# Generate openapi v3 spec from a k8s apiserver and launch a swagger UI | |
# instance to check it out. | |
# | |
# Assumes that k8s api server has been proxied on localhost:8001 | |
# (ie be sure to run `kubectl proxy` prior to execution). | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG python=3.6.13 | |
FROM registry.access.redhat.com/ubi8:latest AS snafu-python-build | |
ARG python | |
RUN dnf install -y --nodocs \ | |
bzip2 \ | |
bzip2-devel \ | |
clang \ | |
gcc \ | |
git \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://unix.stackexchange.com/questions/250713/modify-all-bash-commands-through-a-program-before-executing-them | |
# $BASH_COMMAND contains the command bash is executing | |
# return 0 to allow $BASH_COMMAND to be evaled after function return | |
# return 1 to tell bash not to eval $BASH_COMMAND after function return | |
# requires figlet, cowsay and sl to be installed | |
shopt -s extdebug | |
preexec_invoke_exec () { | |
# do nothing if completing | |
[ -n "$COMP_LINE" ] && return | |
# do nothing if executing a command to issue a prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Upgrade CentOS 7 Hosts to CentOS 8 | |
# Installs kernel from ElRepo for compatibility with deprecated hardware | |
# | |
# Instructions sourced from: | |
# https://www.centlinux.com/2020/01/how-to-upgrade-centos-7-to-8-server.html | |
# https://www.tecmint.com/upgrade-centos-7-to-centos-8/ | |
# | |
# * We don't do rpmconf -a because this is on a clean, freshly installed 7 | |
# * We do a package-cleanup at the end with dnf autoremove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uncensoring study.com lessons is actually pretty simple- it only requires devling into the developer-tools in Google Chrome | |
NOTE: This trick only unblocks the lesson transcripts, I haven't explored getting access to the full lesson video yet. | |
Here are the steps: | |
1. Go to a lesson of choice on study.com and open the developer-tools in Chrome (example URL: | |
http://study.com/academy/lesson/root-cap-function-definition-quiz.html) | |
2. Use the page inspector tool and select the "Lesson Transcript" text. Confirm that in the Elements tab of the dev tools, | |
the line "<span>Lesson Transcript</span>" is highlighted (should be under a div that has the id "transcriptHeader") | |
3. Hit the dropdown triangles of "<div class="transcriptContainer articleContent" data-cname="main_content>" and | |
<div id="mainArticle" class="transcript" data-cname="lesson_transcript"> (the latter should appear after the contents of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pre and Post conditions in Java are done through comments a programmer puts | |
# around methods, or by raising errors directly in a function. However, | |
# if a group of functions need the same pre and post conditions, copying and pasting code | |
# can get tedious. In Python this problem can be avoided through the use of | |
# decorators. A template is laid out below: | |
def checkConditions(func): | |
def wrapped(*args, **kwargs): | |
if not (precondition_bool_expression): |