Skip to content

Instantly share code, notes, and snippets.

Avatar

Kirk Bater iamkirkbater

View GitHub Profile
@iamkirkbater
iamkirkbater / obs_virtual_camera.applescript
Created Jul 22, 2020
Launches OBS, starts the virtual camera, and then minimizes the window.
View obs_virtual_camera.applescript
on run {input, parameters}
tell application "OBS" to activate
tell application "System Events"
tell process "OBS"
set frontmost to true
if name of every menu item of menu "Tools" of menu bar 1 contains "Start Virtual Camera" then
click menu item "Start Virtual Camera" of menu "Tools" of menu bar 1
end if
click (first button of window 1 whose role description is "minimize button")
end tell
@iamkirkbater
iamkirkbater / scaffold.sh
Last active May 7, 2020
A quick options set and verbosity output scaffold for new bash scripts
View scaffold.sh
#!/bin/bash
usage() {
cat <<EOF
usage: $0 [ OPTIONS ]
Options
-d --dry-run Do not make any modifications but preview the expected operations
-h --help Show this message and exit
-q --quiet Be Quiet
-v --verbose Be Loud
View ssl-certificate-validation.tf
resource "aws_acm_certificate" "cert" {
domain_name = "*.${var.domain_name}"
validation_method = "DNS"
lifecycle {
create_before_destroy = true
}
}
data "aws_route53_zone" "zone" {
@iamkirkbater
iamkirkbater / check_default.tf
Created Dec 18, 2018
No default workspaces in terraform
View check_default.tf
resource "null_resource" "have_you_specified_a_workspace" {
count = "${terraform.workspace == "default" ? 1 : 0}"
"ERROR: Select a non-default workspace" = true
}
@iamkirkbater
iamkirkbater / cd.sh
Created Jan 10, 2018
Auto Change NVM version on `cd` command
View cd.sh
cd () {
builtin cd "$@" && [ -f ".nvmrc" ] && nvm use
}
@iamkirkbater
iamkirkbater / instructions.md
Created May 19, 2017
Github SSO To Name Extension Instructions
View instructions.md

Hi,

Thanks for using my Github SSO to Name Chrome Extension. This gist is to help you get all set up.

First off, I want to address any complaints that the extension asks permission to ALL web pages. This is due to the fact that the extension asks you to fill in your specific enterprise URL, and then only runs the code on pages with that URL. We don't use the browser functionality for that because otherwise we'd need to know your enterprise URL, and I'm not putting that into code. Sorry. Please feel free to check out the code, it shouldn't be doing anything shady.

Configuration

To configure the extension, either navigate to chrome://extensions and then find the extension, or click on the icon next to your location bar, and then click on Options. This should give you a page with three options to configure.

@iamkirkbater
iamkirkbater / CommandPattern.java
Created Oct 6, 2016
This is an example of the command pattern for the ISTE 422 Final Project at RIT.
View CommandPattern.java
public interface InputParser {
// variables
Database database;
// methods
void parseFile(File inputFile);
Database getDatabase();
}
@iamkirkbater
iamkirkbater / calendar.twig
Created Jul 11, 2016
Twig Calendar in divs format because tables are hard for responsive. Don't remember where I got this from originally, so if you know or see it let me know and I'll attribute.
View calendar.twig
{#
Creates a faux table twig calendar.
Takes the following variables:
month
currentDay
calendarContent
month can be any string acceptable by http://www.php.net/strtotime, the
template will output that time's month.
@iamkirkbater
iamkirkbater / macros.forms.twig
Created Apr 5, 2016
Twig Macros for forms. Uses an array of attributes instead of 400 separate parameters for separate values. Also abstracts HTML5 text types for ease of reading in your template files.
View macros.forms.twig
{% macro input(name, value, type, attributes) %}
<input name="{{ name }}" type="{{ type }}" value="{{ value }}"{% for attr, value in attributes %} {{ attr }}="{{ value }}"{% endfor %}{% if not attributes.id is defined %} id="{{ name }}"{% endif %}/>
{% endmacro %}
{% macro text(name, value, attributes) %}
{% from _self import input %}
{{ input(name, value, "text", attributes) }}
{% endmacro %}
{% macro password(name, value, attributes) %}
@iamkirkbater
iamkirkbater / old.Controller.php
Created Feb 14, 2016
Converting to Laravel Validator instead of doing the logic in the controller:
View old.Controller.php
$start = $request->get('start');
$end = $request->get('end');
$project = $request->get('project_id');
$task = $request->get('task_id');
if ( ! $start || ! is_int($start))
{
return new Response(["error" => true, "message" => "Start time is not valid."], HTTP::BAD_REQUEST);
}
You can’t perform that action at this time.