Skip to content

Instantly share code, notes, and snippets.

View mike10004's full-sized avatar

Mike Chaberski mike10004

View GitHub Profile
@mike10004
mike10004 / ManualWebdrivingHarness.java
Created February 5, 2020 20:55
Program that allows you to test out webdriver API while the browser is open
package manualwebdrivingharness;
import com.github.mike10004.seleniumhelp.*;
import io.github.mike10004.nanochamp.server.NanoControl;
import io.github.mike10004.nanochamp.server.NanoResponse;
import io.github.mike10004.nanochamp.server.NanoServer;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@mike10004
mike10004 / README.md
Created January 17, 2020 15:38
Visual Studio v140 toolset linker error from Googletest

Visual Studio v140 toolset linker error from Googletest

This example demonstrates a linker error observed when building a Google Test project with the v140 platform toolset.

@mike10004
mike10004 / Poller.java
Last active November 20, 2019 15:05
Java class to facilitate polling of anything
import javax.annotation.Nullable;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Iterator;
import java.util.Objects;
import java.util.function.BooleanSupplier;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
import java.util.stream.Stream;
@mike10004
mike10004 / jsr303_validator_failed_to_initialize_fix.md
Created October 14, 2019 17:53
Potential fix for "JSR-303 validator failed to initialize" error for jcabi-mysql-maven-plugin

On JDK11, you may see an error with the following description

// [ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://aspects.jcabi.com/jsr-303.html)

Adjust the plugin dependencies as follows:

<pluginManagement>
    <plugins>
        <plugin>

com.github.mike10004

@mike10004
mike10004 / cuda-9-tensorflow-setup.md
Last active June 4, 2019 21:56
Setup instructions for CUDA 9.0 with Python/Anaconda tensorflow-gpu environment

Setup on Ubuntu 18.04

Prerequsities

Install Anaconda 3 from https://www.anaconda.com.

Install the build-essential package. // TODO install gcc 6 instead of 7

NVIDIA prep

@mike10004
mike10004 / README.md
Last active April 11, 2019 19:50
Ant build helpers to install Python programs locally in user directory

Ant build helpers for user-scoped Python 3 program installation

Sometimes I have projects that contain number of Python programs that I use for data processing. I want to be able to execute these programs from any working directory, but I don't want to pollute my filesystem outside of my home directory with the sources and executables.

For such a use case, I use Ant with build files like those contained in this gist.

The typical structure of a project that can take advantage of these helpers looks like:

@mike10004
mike10004 / README.md
Last active February 5, 2019 19:25
systemd unit and script to mount VMWare shared folders on Ubuntu guest boot

VMWare Linux Guest - script and systemd unit to print IP address to file in shared folder

Preparation

Set up shared folders through the VMWare Player GUI on the host.

On the guest, create an /etc/fstab entry like

.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,auto_unmount,defaults 0 0
@mike10004
mike10004 / README.md
Last active December 18, 2018 16:56
ES6 Unit Testing Module compatible with Node

exams

This is a single-file ES6 module for unit testing. The reason it exists is that I became frustrated one day when I tried to learn how to run unit tests for ES6 modules in Node. I discovered that Node doesn't like ES6 modules and neither do any unit testing libraries. The JavaScript ecosystem has some peculiar pathologies. The answer to any problem seems to be to use Babel to make your new code become old.

Usage

@mike10004
mike10004 / socket_wait.sh
Created December 5, 2018 16:11
bash script that uses netcat to wait for a socket to be listening before running a program
#!/bin/bash
#
# socket_wait.sh
#
# Script that runs a command after a socket can be opened. Tests the socket
# using netcat and runs the command once a connection succeeds.
#
# Requires that environment variables SOCKET_WAIT_HOST and SOCKET_WAIT_PORT
# are defined and nonempty.
#
@mike10004
mike10004 / inject.py
Created November 1, 2018 14:47
David Buchanan's JPEG injection code
#!/usr/bin/python3
"""
WARNING: The code you are about to view is DISGUSTING
I wrote most of it months ago, so don't ask me what it's doing, or why.
"""
import struct
import sys