Skip to content

Instantly share code, notes, and snippets.

View tonylegrone's full-sized avatar

Tony Legrone tonylegrone

  • Chronicle
  • Birmingham Alabama
View GitHub Profile
@tonylegrone
tonylegrone / gamepadviewer.css
Created May 11, 2020 21:16
Custom css for gamepadviewer.com
.xbox .stick {
background: #aaa;
border-radius: 100%;
}
.xbox .stick.pressed {
background-color: #888;
}
@tonylegrone
tonylegrone / ec2-ubuntu-nginx-deploy.sh
Last active April 3, 2020 15:52
Zero downtime deployment script for ubuntu nginx server on EC2
#!/bin/bash
set -e
die () {
echo >&2 "$@"
exit 1
}
reset_opcache() {
#include <OneWire.h>
#include <DallasTemperature.h>
#include <FanController.h>
#define ONE_WIRE_BUS 7
#define SENSOR_PIN 2
#define SENSOR_THRESHOLD 1000
#define PWM_PIN 9
#define GATE_PIN 4
# vim: set ft=sh sw=2 ts=2 expandtab:
# -polka-
# git_prompt_info accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
git_prompt_info () {
local g="$(git rev-parse --git-dir 2>/dev/null)"
if [ -n "$g" ]; then
local r
local b
#!/bin/bash
get_conf() {
# Reading options from .drbuild
source ./.drbuild
}
# simple prompt
prompt_yes_no() {
while true ; do
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.restful-printing</string>
<key>ProgramArguments</key>
<array>
@tonylegrone
tonylegrone / git_prompt.zsh
Last active August 29, 2015 14:25 — forked from joshdick/git_prompt.png
My Git prompt for zsh.
# Adapted from code found at <https://gist.github.com/1712320>.
setopt prompt_subst
autoload -U colors && colors # Enable colors in prompt
# Modify the colors and symbols in these variables as desired.
GIT_PROMPT_SYMBOL="%{$fg[blue]%}±"
GIT_PROMPT_PREFIX=""
GIT_PROMPT_SUFFIX=""
GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}"
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Base16 Color Schemes/base16-flat.dark.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.komodo*",
@tonylegrone
tonylegrone / breakpoint.js
Created November 4, 2014 18:05
Quick little function for testing screensize against breakpoints. Requires jQuery.
/**
* Determines if screen size is within givin breakpoint.
*
* @param (string) op
* The breakpoint size to compare. Supported sizes are medium, large, xlarge
* and giant.
*
* @param (bool) mobileFirst
* Changes comparison from <= to >= if set to false. Deafults to true.
<?php
/**
* Calculates approximate reading time in minutes.
*
* @param (string) $str
* The string of words to calculate reading time on.
* @param (int) $words_per_minute
* The words per minute to divide the time by. Defaults to 270.
* @return (string)