Skip to content

Instantly share code, notes, and snippets.

View gwpantazes's full-sized avatar

George Pantazes gwpantazes

View GitHub Profile
@gwpantazes
gwpantazes / getTypedStringEnumArray.ts
Last active September 9, 2020 21:56
Function to get typesafe Typescript enum member array
export function getTypesafeEnumArray<T>(enumType: T): T[keyof T][] {
return Object.keys(enumType)
.filter((key) => isNaN(Number(enumType[key as keyof typeof enumType])))
.map((key) => enumType[key as keyof typeof enumType]);
}
enum OrdinalEnum {
ONE,
TWO
}
@gwpantazes
gwpantazes / Incremental Steps to Running a Docker R Project.md
Last active June 26, 2020 15:17
Incremental Steps to Running a Docker R Project

Incremental Steps to Running a Docker R Project

This guide shows an incremental approach to running a full R project with docker, from docker installation to creating your own containerized R project.

About Docker

This guide isn't going to go in-depth on how Docker works. We'll only cover necessary concepts if it's relevant at a particular step. To learn more about Docker, see the Docker Getting Started Overview.

Diagram of Docker Overview

@gwpantazes
gwpantazes / keybase.md
Created March 2, 2020 18:30
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@gwpantazes
gwpantazes / MyStepDefs.java
Created September 12, 2019 22:05
Cucumber Scenario Outline and custom configured ParameterType aren't compatible for step highlighting/usage detection
package com.example.test;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class MyStepdefs {
@Given("that we're using a scenario outline")
@gwpantazes
gwpantazes / SafariBugWorkaround.java
Last active April 14, 2021 13:47
SafariDriver can't clear cookies
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
class SafariBugWorkaround {
/**
* Delete all the cookies for the current domain.
*
* <p>Should be used in-place of {@link WebDriver.Options#deleteAllCookies()} until <a
* href="">this {@code SafariDriver} bug</a> is fixed.
@gwpantazes
gwpantazes / # python - 2019-06-25_13-09-58.txt
Created June 25, 2019 20:37
python on macOS 10.14.5 - Homebrew build logs
Homebrew build logs for python on macOS 10.14.5
Build date: 2019-06-25 13:09:58
@gwpantazes
gwpantazes / check-venv.sh
Created June 25, 2019 18:41
Check if you are in a Python Virtual Environment
# 100% surefire way to detect a virtual environment: Check for the real_prefix system attribute.
echo $(python <<EOF
import sys
if(hasattr(sys, 'real_prefix')):
print("Yes, you are in a virtual environment. (" + getattr(sys, 'real_prefix') + ")")
else:
print("No, you are not in a virtual environment.")
EOF
)
@gwpantazes
gwpantazes / SeleniumDriverUserAgentConfigurations.java
Last active January 26, 2023 14:37
Setting Selenium WebDriver useragents
import io.github.bonigarcia.wdm.WebDriverManager;
import java.io.IOException;
import java.util.Map;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
/*
@gwpantazes
gwpantazes / .bash_profile
Last active June 5, 2020 15:27
.bash_profile Java/jenv configuration which sets JAVA_HOME dynamically from jenv
# Java Configuration: jenv, JAVA_HOME, utilities and aliases, etc...
DEFAULT_JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home"
if which jenv > /dev/null
then
export JENV_ROOT="$HOME/.jenv"
export PATH="$JENV_ROOT/bin:$PATH"
# Enable shims and autocompletion.
# WARNING jenv init wipes out any previously set JAVA_HOME variable.
eval "$(jenv init -)"
@gwpantazes
gwpantazes / uninstallGpgSuiteMailPlugin.sh
Created October 29, 2018 14:38
Uninstall Mac GPGSuite Mail Plugin
# First quit Mail
osascript -e 'quit app "Mail"'
# Delete the GPG Suite Mail Plugin(s) from the Mail bundles
sudo rm -rf /Library/Mail/Bundles/GPGMail*