Skip to content

Instantly share code, notes, and snippets.

View cr0wst's full-sized avatar

Steve Crow cr0wst

View GitHub Profile
@cr0wst
cr0wst / Auto Clap Close.cpp
Created January 22, 2022 15:59
First pass at a count down zoom closer on a Teensy 3.2
#include <Arduino.h>
#include <Bounce.h>
#include <Keyboard.h>
// Pins
const int BUTTON_PIN = 0;
const int GREEN_LED_PIN = 5;
const int YELLOW_LED_1_PIN = 4;
const int YELLOW_LED_2_PIN = 3;
const int YELLOW_LED_3_PIN = 2;
// Finding a single user using a specification
val filteredUser = userRepository.findOne(specification).orElseThrow { UserNotFoundException() }
// Finding a single user using a specification with nullable
val filteredUser = userRepository.findOneOrNull(specification) ?: throw UserNotFoundException()
@cr0wst
cr0wst / JpaSpecificationRepositoryExtensionFunction.kt
Last active November 8, 2021 16:41
JpaSpecificationRepository Nullable Extension Function
/**
* By default [JpaSpecificationExecutor.findOne] returns an Optional. This extension function wraps it to return a nullable instead.
*/
fun <T> JpaSpecificationExecutor<T>.findOneOrNull(specification: Specification<T>): T? =
findOne(specification)
.orElse(null)
@cr0wst
cr0wst / webcam-capture.py
Created July 24, 2019 16:26
Get Webcam Video
import cv2
import imutils
IMAGE_WIDTH = 640
def main():
cap = cv2.VideoCapture(1)
while True:
ret, frame = cap.read()
frame = imutils.resize(frame, IMAGE_WIDTH)
@cr0wst
cr0wst / resume.json
Last active January 29, 2021 17:24
JSON Resume
{
"basics": {
"name": "Steve Crow",
"label": "Web Developer",
"picture": "https://smcrow.net/me.jpg",
"email": "steve@smcrow.com",
"website": "https://smcrow.com",
"summary": "I am a polyglot developer with experience in Java, Kotlin, and PHP. I love working both on and with open-source projects. I enjoy deep-diving into various frameworks and technologies and am not afraid to get my hands dirty.",
"location": {
"city": "Columbus",
@cr0wst
cr0wst / SENDSMSC.cbl
Last active June 30, 2020 20:35
Send SMS from COBOL by executing curl
******************************************************************
* Author: Steve Crow (steve.crow@nexmo.com)
* Date: March 6 2019
* Purpose: Send an SMS using COBOL and curl via command line.
* Tectonics: cobc
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. SENDSMS.
DATA DIVISION.
WORKING-STORAGE SECTION.
@cr0wst
cr0wst / SENDSMS.cbl
Created March 6, 2019 18:48
Send SMS Using Nexmo CLI triggered via GnuCOBOL
******************************************************************
* Author: Steve Crow (steve.crow@nexmo.com)
* Date: March 6 2019
* Purpose: Send an SMS using COBOL to trigger the Nexmo CLI
* Tectonics: cobc
* First install the Nexmo CLI (curl example coming shortly)
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. SENDSMS.
DATA DIVISION.
@cr0wst
cr0wst / verify.java
Created February 8, 2019 15:00
Verification Process
// Send CODE to user
VerifyResponse response = client.getVerifyClient().verify(RECIPIENT_NUMBER, BRAND);
// Check CODE from user
CheckResponse checkResponse = client.getVerifyClient().check(REQUEST_ID, CODE);
if (checkResponse.getStatus() == VerifyStatus.OK) {
// Successful verification!
}

Keybase proof

I hereby claim:

  • I am cr0wst on github.
  • I am cr0wst (https://keybase.io/cr0wst) on keybase.
  • I have a public key ASAoUK7EBrBF05fCxCzsxRJjHxx_jpeMHD5disw3sTt_rwo

To claim this, I am signing this object:

@cr0wst
cr0wst / CreateListsOfProperties.java
Created June 17, 2018 15:21
Java Stream Example: Create lists of properties of list of objects.
package net.smcrow.sandbox.streams;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class CreateListsOfProperties {
private static final List<Person> PEOPLE = List.of(new Person("Sarah", 29),
new Person("John", 16),