Skip to content

Instantly share code, notes, and snippets.

View William-Lake's full-sized avatar

William Lake William-Lake

  • State of Montana
View GitHub Profile
@William-Lake
William-Lake / arg_parser_builder.py
Last active October 27, 2019 13:29
Builds a __main__.py file gathering args via argparse. Covers a *very limited* range of options, primarily the ones I find useful. arg_parser_template.txt needs to be in the same dir as arg_parser_builder.py. Produces a __main__.py file in the same dir when finished.
def gather_input(prompt,empty_ok=False):
user_input = None
while user_input is None:
print(prompt)
user_input = input('?')
@William-Lake
William-Lake / Instructions.md
Created March 29, 2019 13:06
Running Python unittests with conda environment via cronjob

Instructions

  • Create crontab string via crontab.guru
  • Create a bash script to run your unittests

E.g.

#!/bin/bash

# Not certain this is necessary...
@William-Lake
William-Lake / Instructions.adoc
Last active March 7, 2019 17:14
Setting up Windows to use Python Scripts

Setting up Windows to use Python Scripts

  1. Install Python[https://www.python.org/downloads/windows/]

  2. Create a directory to contain your scripts.

  3. Add your created directory to your path.

    1. Start Menu

    2. Type in "environment" and select "Edit Environment variables for your account".

    3. In the upper group titled "User variables for [YOUR NAME]" click the "New…​" button.

    4. Enter your desired variable name (standard is to be in all caps, use underscores instead of spaces, and only letters. E.g. WILLS_PYTHON_SCRIPTS)

    5. Enter the path to your script dir as the Variable Value. Click the "OK" button.

@William-Lake
William-Lake / README.md
Last active December 27, 2018 14:45
*SIMPLE* Python Class Wizard

Create Python Class File

A very basic wizard for creating a python class file.

Getting Started

NOTE: These instructions were written for Linux.

  1. Download the required files.
  2. Make the script executable
@William-Lake
William-Lake / RSToPOJOConverter.java
Created October 11, 2018 18:55
Generic ResultSet to POJO Converter
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@William-Lake
William-Lake / HowTo.md
Created January 7, 2018 13:35
How to send an email via mutt in a bash script on a recurring basis with crontab.

How to send an email via mutt in a bash script on a recurring basis with crontab.

This was suprisingly difficult for me, so I'm making this quick guide so I have it handy in the future.

Steps

  1. Set up mutt using this guide
  2. Create your bash script that will be sending emails using mutt.
  3. When creating your bash script, add the following line to your mutt command:
@William-Lake
William-Lake / HowTo.md
Last active December 11, 2017 16:26
VBox Windows Host / Ubuntu 16.04 Server Guest : Create Shared folder
@William-Lake
William-Lake / Main.java
Created September 18, 2017 19:04
JavaFX - VERY BASIC Sample application
package main;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
@William-Lake
William-Lake / RemovePunct.java
Last active May 4, 2021 14:34
Java - Use .replaceAll() to remove punctuation from String via regex.
word = word.replaceAll("\\p{Punct}+", "");
@William-Lake
William-Lake / RemovingDupLines.txt
Last active September 18, 2017 18:34
How to remove duplicate lines from text data in notepad++
Source: http://webcache.googleusercontent.com/search?q=cache:https://notepad-plus-plus.org/community/topic/11466/eliminate-duplicate-rows-show-unique-rows-only
(Cached with Google in case it ever goes down.)
1) Open notepad++ and paste in data you want duplicate lines removed from.
2) Edit -> Line Operations -> Sort Lines Lexicographically Ascending
3) Ctrl + F
4) Search for: ^(.+?)\R(\1\R?)+
5) Replace with: \1\r\n