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 && \
@yock
yock / bot.js
Last active May 15, 2019 15:22
Nodebots Day Code
var five = require("johnny-five");
var Particle = require("particle-io");
var board = new five.Board({
io: new Particle({
token: 'mytoken',
deviceName: 'changeme!'
})
});
@yock
yock / uri.sh
Last active December 28, 2018 23:42
URL Parsing function for Bash
#
# URI parsing function
#
# The function creates global variables with the parsed results.
# It returns 0 if parsing was successful or non-zero otherwise.
#
# [schema://][user[:password]@]host[:port][/path][?[arg1=val1]...][#fragment]
#
function uri_parser() {
# uri capture
@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');
/**
* 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';
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}")