Skip to content

Instantly share code, notes, and snippets.

View brycepg's full-sized avatar

Bryce Guinta brycepg

View GitHub Profile
@brycepg
brycepg / flask-dynamic-static-endpoint.py
Created July 15, 2020 20:32
Dynamically change flask static endpoint for url_for
# Flask creates a rule for the static endpoint a initialization
# this means that setting static_url_path and static_folder
# after initilzation do not change the result of url_for('static', filename=...)
# app is in instance of the Flask class
# Your new static path, update the instance just to keep everything consistent
app.static_url_path = "/foo"
# Delete the old rule and substitute your own
@brycepg
brycepg / fix.patch
Created December 26, 2018 17:31
pyopenssl==0.13 patch
--- OpenSSL/crypto/crl.c 2018-12-26 12:23:14.275648440 -0500
+++ OpenSSL/crypto/crl2.c 2018-12-26 12:15:16.720820270 -0500
@@ -3,7 +3,7 @@
#include "crypto.h"
-static X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
+X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
X509_REVOKED *dupe = NULL;
@brycepg
brycepg / centos7-sphinx-latex.sh
Last active December 1, 2022 09:28
Install Sphinx latexpdf Dependencies for Centos 7
#!/bin/bash
# source: https://cbs.centos.org/koji/rpminfo?rpmID=45050
set -xeuo pipefail
sudo yum install -y "tex(cmap.sty)" "tex(ecrm1000.tfm)" "tex(fancybox.sty)" "tex(footnote.sty)" "tex(framed.sty)" "tex(multirow.sty)" "tex(parskip.sty)" "tex(threeparttable.sty)" "tex(titlesec.sty)" "tex(upquote.sty)" "tex(wrapfig.sty)" "texlive-collection-fontsrecommended" "texlive-collection-latex" "tex(fncychap.sty)" python-sphinx > /dev/null
# Determine latex search directory
SEARCH_DIRECTORY="$(kpsewhich -var-value=TEXMFHOME)/tex/latex/local"
mkdir -p "$SEARCH_DIRECTORY"
# capt-of.sty has no Centos 7 package
@brycepg
brycepg / ip.sh
Last active July 10, 2021 01:26
Get IP Address from hostname bash function
# Get IP address from hostname using Python
# Args:
# $1 - hostname
# Returns:
# The ip address
ipfromhostname() {
local hostname="$1"
if [ -z "$hostname" ]; then
>&2 echo 'Must supply hostname as an argument'
return 1
@brycepg
brycepg / 1. logfile.html
Last active July 31, 2020 19:49
vdbench failure due to network switch failure
<title>Vdbench R4K0R_1QD/logfile.html</title><pre>
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Vdbench distribution: vdbench50406
22:04:51.166 input argument scanned: '-o/home/bguinta/data/R4K0R_1QD'
22:04:51.168 input argument scanned: '-d12'
22:04:51.168 input argument scanned: '-f/home/bguinta/data/R4K0R_1QD/parm.txt'
22:04:51.168 input argument scanned: '-m1'
22:04:51.169 java.vendor Oracle Corporation
22:04:51.169 java.home /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64/jre
<title>Vdbench henkdebug4-curved/localhost-0.stdout.html</title><pre>
stdout/stderr for slave=localhost-0
14:42:39.311 14:42:39.310 SlaveJvm execution parameter: '-m localhost'
14:42:39.311 14:42:39.311 SlaveJvm execution parameter: '-n localhost-10-170327-14.42.39.017'
14:42:39.311 14:42:39.311 SlaveJvm execution parameter: '-l localhost-0'
14:42:39.311 14:42:39.311 SlaveJvm execution parameter: '-p 5570'
14:42:39.312 14:42:39.311 SlaveJvm positional parameter: 'SlaveJvm'
14:42:39.321 14:42:39.320 successfully connected to master localhost
14:42:39.321 14:42:39.321 Connection to localhost using port 5570 successful
<title>Vdbench henkdebug2-fix/localhost-0.stdout.html</title><pre>
stdout/stderr for slave=localhost-0
12:15:51.782 12:15:51.781 SlaveJvm execution parameter: '-m localhost'
12:15:51.782 12:15:51.781 SlaveJvm execution parameter: '-n localhost-10-170327-12.15.51.514'
12:15:51.782 12:15:51.781 SlaveJvm execution parameter: '-l localhost-0'
12:15:51.782 12:15:51.781 SlaveJvm execution parameter: '-p 5570'
12:15:51.782 12:15:51.781 SlaveJvm execution parameter: '-d 48'
12:15:51.782 12:15:51.781 SlaveJvm positional parameter: 'SlaveJvm'
12:15:51.793 12:15:51.792 successfully connected to master localhost
@brycepg
brycepg / main.py
Last active October 5, 2016 03:55
Generate List Combinations Using Bitwise Arithmetic
def combinate(list_):
"""Generate all combinations of a list(unordered)"""
combinations = []
for count in range(1, 2**len(list_)):
combinations.append(
[elem for cur_index, elem in enumerate(list_)
if (count >> cur_index) & 1]
)
return combinations
@brycepg
brycepg / exc_report.ipynb
Last active August 12, 2016 06:24
Return Report of Procedural Functions using Decorators in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brycepg
brycepg / yield_from.ipynb
Created August 10, 2016 06:40 — forked from anonymous/yield_from.ipynb
Why Python's 3.x's "yield from" is useful
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.