Skip to content

Instantly share code, notes, and snippets.

@jamesdh
jamesdh / geb_chromedriver_request_inspect.groovy
Created September 29, 2022 17:01
Inspecting ChromeDriver HTTP Requests
// A simple Geb (gebbish.org) WebDriver config
import io.github.bonigarcia.wdm.WebDriverManager
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeDriverService
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.logging.LogType
import org.openqa.selenium.logging.LoggingPreferences
driver = {
// Uses https://github.com/bonigarcia/webdrivermanager to automate chromedriver setup
@jamesdh
jamesdh / gist:6315d675bd71a03479a9d7909dc1188b
Created June 9, 2022 15:07 — forked from mhucka/gist:59e785a315d813d14cd0258b89a2fcac
Stop the Adobe Creative Cloud app from auto-launching on login on macOS
#!/bin/bash
# =============================================================================
# @file GitHub gist
# @brief stop Adobe Creative Cloud app from auto-launching on login on macOS
# @author Michael Hucka <mhucka@caltech.edu>
# @created 2021-08-12
# @website https://gist.github.com/mhucka/59e785a315d813d14cd0258b89a2fcac
#
# I find Adobe Creative Cloud absolutely infuriating. It installs auto
# launchers that are not in the user's login app list, and the services are
@jamesdh
jamesdh / AuthyToOtherAuthenticator.md
Created January 18, 2022 17:59 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@jamesdh
jamesdh / jpa-cheatsheet.java
Created August 27, 2021 04:32 — forked from jahe/jpa-cheatsheet.java
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@jamesdh
jamesdh / justices.csv
Created June 2, 2021 20:31
Supreme Court Justices Data
We can't make this file beautiful and searchable because it's too large.
name,yrnom,posit,recess,success,id,analu,seatid,spaethid,zukid,birdate,biryear,birthcit,birthst,childcit,childst,childsur,famses,famjud,nomrelig,natorig,race,gender,mothname,fathname,fathoccu,fathpol,fathpoln,undsch,undsta,unddat,undschn,gradsch,gradsta,graddat,gradschn,lawsch,lawsta,lawdat,lawschn,read,readst,readyr,readn,marryn,spouse,marryr,child,militbr,milityr1,milityr2,militran,militwar,clerkj,clerkyr1,clerkyr2,barst1,baryr1,barst2,baryr2,barst3,baryr3,privtyp1,privst1,privyrf1,privyrl1,privtyp2,privst2,privyrf2,privyrl2,schname1,schrank1,schyrf1,schyrl1,schname2,schrank2,schyrf2,schyrl2,schn,schcon,sttrist,sttriyr1,sttriyr2,stapst,stapyr1,stapyr2,stsupst,stsupyr1,stsupyr2,feddist,feddi,feddiyr1,feddiyr2,fedca,fedcayr1,fedcayr2,usasat,usasat1,usasat2,usat,usat1,usat2,ussgo1,ussgo2,ussg1,ussg2,usago1,usago2,usag1,usag2,uscab,uscab1,uscab2,ussec,ussec1,ussec2,usage,usage1,usage2,usagh,usagh1,usagh2,uspres1,uspres2,ushr1,ushryrf1,ushryrl1,ushr2,ushryrf2,ushryrl2,ussn1,ussnyrf1,ussnyrl1,ussn2,ussnyrf2,ussny
@jamesdh
jamesdh / nginx.conf
Created April 6, 2021 20:46 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@jamesdh
jamesdh / IntegrationSpec.groovy
Created March 2, 2021 14:43
Starting TestContainers and modifying config at startup in a Micronaut project
package com.example
import groovy.util.logging.Slf4j
import io.micronaut.test.support.TestPropertyProvider
import org.testcontainers.containers.GenericContainer
import org.testcontainers.utility.DockerImageName
import spock.lang.Specification
@Slf4j
@jamesdh
jamesdh / Commands For Compress And Decompressesing
Created October 18, 2018 15:00 — forked from zetavg/Commands For Compress And Decompressesing
bash commands for compress and decompressesing
# COMMANDS FOR COMPRESS AND DECOMPRESSESING
# Usage:
# mk* OutputFileName.* InputDirName
# do* InputFileName
# un* InputFileName.*
#
# tar
alias mktar='tar cvf'
alias untar='tar xvf'
# gz
@jamesdh
jamesdh / notify.py
Created May 31, 2016 19:32 — forked from lukaszb/notify.py
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')
on run argv
# fill in your working hours here
set start_time_morning to convert_minutes(8.0)
set finish_time_morning to convert_minutes(12.3)
set start_time_afternoon to convert_minutes(14.0)
set finish_time_afternoon to convert_minutes(18.0)
# -----------------------------------------
set start_time_morning_secs to start_time_morning * 3600
set finish_time_morning_secs to finish_time_morning * 3600
set start_time_afternoon_secs to start_time_afternoon * 3600