Skip to content

Instantly share code, notes, and snippets.

View yock's full-sized avatar

Michael Yockey yock

View GitHub Profile
@yock
yock / .gitconfig
Last active April 25, 2023 14:26
Global Gitignore for Editor Projectfiles
# Lives at $HOME/.gitconfig but should already exist
# Core section may already exist. Add this line to that section but change the path to match your home directory.
[core]
excludesfile = /Users/myockey/.gitignore
@yock
yock / README.md
Created January 19, 2021 20:49 — forked from jamesmacfie/README.md
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.

server:
verbosity: 0
interface: 0.0.0.0
access-control: 127.0.0.0/8 allow
access-control: 192.168.1.0/24 allow
do-ip4: yes
do-tcp: yes
do-udp: yes
2020/05/20 19:20:36:517 DHAlfredWorkflow: Alfred 3 syncFolder: (null)
2020/05/20 19:20:36:518 DHAlfredWorkflow: Alfred 2 syncFolder: (null)
2020/05/20 19:20:36:519 DHAlfredWorkflow: rebuild dashPath: (null) syncFolder: (null)
2020/05/20 19:20:36:520 DHAlfredWorkflow: workflowsPath: /Users/myockey/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows
2020/05/20 19:20:36:520 DHAlfredWorkflow: Attempting to find Dash workflow in syncFolder (null): (null)
FROM ubuntu:bionic
WORKDIR /opt
# Install dependencies
RUN apt-get update && \
apt-get -y install curl unzip build-essential cmake valac libgee-0.8-dev libgtk-3-dev libqalculate-dev libgranite-dev libsoup2.4-dev libgtksourceview-3.0-dev
# Fetch and build nasc
RUN curl -L -o nasc.zip https://github.com/parnold-x/nasc/archive/master.zip && \
/**
* Makes ideal change based on the difference between the purchase price of an item,
* how much cash is tendered, and the current contents of the register
*
*/
const makeChange = (purchasePrice, cashTendered, cashRegisterContents) => {
// Exact change tendered
// Oops
throw 'Insufficient Funds';
@yock
yock / bot.js
Created February 22, 2018 22:49
Particle Bot
/*
With much credit to @BrianGenisio, this code is almost entirely his.
https://github.com/CareEvolution/nodebots-unleashed-codemash-docs/blob/master/examples/base-sumobot.js
*/
import Five from 'johnny-five';
import board from './board';
board.on("ready", function() {
console.log('ready');
class AuthenticateController < ApplicationController
DIGEST = OpenSSL::Digest::SHA256.new
def show
end
def create
nonce = Time.now.to_i
token = SecureRandom.hex
hmac = OpenSSL::HMAC.digest(DIGEST, 'soopersecret', "#{nonce}#{token}")
@yock
yock / backup.sh
Created March 22, 2017 14:59
Super primitive database backup script
#!/bin/bash
backup_date=$(date +%s)
defaults_file=./my.cnf
destination=./backups
basename=backup
cleanup=false
cleanup_interval="+30"
dryrun=false
compress=false
@yock
yock / pki.yml
Last active March 16, 2017 14:13
- hosts: all
tasks:
- name: Update public keys
authorized_key:
user: server_username
key: https://github.com/github_username.keys