Skip to content

Instantly share code, notes, and snippets.

Tschüss STL

Joshua Haupt HauptJ

Tschüss STL
View GitHub Profile
HauptJ / config.rb
Created Aug 4, 2020
Config file for the Vagrantfile used to test Hyper-V and Virtualbox coexistence -
View config.rb
# VM Config
$ssh_user = "vagrant"
$vcpus = "4"
$vmem = "4096"
$centos8_box = "generic/centos8"
$centos8_box_ver = "3.0.10"
# Synced Folders
HauptJ / Vagrantfile
Last active Aug 4, 2020
Vagrantfile to test Hyper-V and Virtualbox coexistence - Config:
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# NOTE: Variable overrides are in ./config.rb
require "yaml"
require "fileutils"
# Use a variable file for overrides:
CONFIG = File.expand_path("config.rb")
if File.exist?(CONFIG)
require CONFIG
HauptJ /
Created Jun 26, 2020
Python Word Count using Dictionary
Find repeating words within text file
word and count
Sentence is here. Sentence two is here.
def find_grants_cap(grantsArray, newBudget):
cap = float(0)
grantsArray.sort(reverse = True)
# pad the array with a zero at the end to cover the case where 0 <= cap <= grantsArray[i]
# calculate the total amount we need to cut back to meet the reduced budget
surplus = sum(grantsArray) - newBudget
def bracket_match(text):
stack = []
for char in text:
if char == ")":
if stack:
if stack[-1] == "(":
HauptJ /
Last active Jun 17, 2020
Vagrant Ansible self provisioning shell script for EL 8
#!/bin/bash -eux
pushd /tmp
sudo dnf -y install python3 git ansible
#sudo python3 -m pip install pyyaml ansible
pushd /tmp/ansible
import sys
import os
import pandas as pd
NARRATIVE = "Consumer complaint narrative"
inFile = str(sys.argv[1])
label = str(sys.argv[2])
outFile = label.replace(" ", "_")
HauptJ /
Created Mar 28, 2020
OVH API Re-Imaging Script
#!/usr/bin/env python3
import ovh
import json
import argparse
def reimage(ovhClient, ovhServerName, sshKeyName, hostName, ovhTemplateName, useDistribKernel=False):
HauptJ /
Created Mar 14, 2020
Maximum Subarray Sum
class Solution:
# Dynamic Programming: Time: O(n) Space O(n)
def maxSubArrayDP(self, nums: List[int]) -> int:
if not nums:
return 0
maxSum = nums[0]
DP = [0]*len(nums) # DP will hold the max sum so far
HauptJ /
Created Mar 14, 2020
LinkedList Palindrome - Stack
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
# low hanging fruit