Skip to content

Instantly share code, notes, and snippets.

View doches's full-sized avatar
🍸
Probably asleep

Trevor Fountain doches

🍸
Probably asleep
View GitHub Profile
#!/bin/bash
set -euxo pipefail
dnf install -y fail2ban
systemctl enable fail2ban
cat > /etc/fail2ban/jail.local<< EOF
[DEFAULT]
# Ban hosts for one hour:
@doches
doches / linode_centos_stream.sh
Last active March 3, 2022 12:11
Update Linode CentOS 8 to CentOS 8 Stream
#!/bin/bash
set -euxo pipefail
if [ -f "/etc/yum.repos.d/CentOS-Linux-BaseOS.repo" ]; then
sed -i 's/baseurl/#baseurl/' /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
echo "baseurl=http://vault.centos.org/\$contentdir/\$releasever/BaseOS/\$basearch/os/" >> /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
fi
if [ -f "/etc/yum.repos.d/CentOS-Base.repo" ]; then
sed -i 's/baseurl/#baseurl/' /etc/yum.repos.d/CentOS-Base.repo
echo "baseurl=http://vault.centos.org/\$contentdir/\$releasever/BaseOS/\$basearch/os/" >> /etc/yum.repos.d/CentOS-Base.repo
{
"version": "4.0.0",
"gauges": {
"io.dropwizard.jetty.MutableServletContextHandler.percent-4xx-15m": {
"value": 0.007024159313128319
},
"io.dropwizard.jetty.MutableServletContextHandler.percent-4xx-1m": {
"value": 0.7550973761653571
},
"io.dropwizard.jetty.MutableServletContextHandler.percent-4xx-5m": {
using UnityEngine;
// Usage: add to a light, specify 6-10 intervals. For a rapidly flickering light, use very short
// intervals (e.g. 0.01 - 0.3); for a horror-esque feel, use a combination of long and short intervals,
// e.g. [2.1, 0.1, 0.1, 0.2, 0.1, 0.2] for a light that flickers every 2-ish seconds.
public class LightFlicker : MonoBehaviour
{
public float[] intervals = new float[1];
private Light light;
private float elapsed = 0f;
@doches
doches / .block
Last active September 23, 2016 03:09 — forked from mbostock/.block
Bar Chart
license: csl
@doches
doches / minutes.rb
Created September 5, 2012 22:50
Compute the difference in minutes between two RFC2822-formatted dates
#!/usr/bin/env ruby
# A Ruby function to compute the difference in minutes between two
# RFC2822-formatted dates. Tested on Ruby 1.8.7
#
# Note: this feels a bit cheeky, since Ruby's standard library has excellent
# support for timestamp conversions; this is basically a CLI wrapper around
# Time#rfc2822 and the subtraction operator between Time objects. Then again,
# this is the *reason* I'd use Ruby for a task like this (over, say, C++)...
#
# Author::Trevor Fountain (trevor@texasexpat.net)
@doches
doches / reference.lua
Created March 27, 2012 19:47
Lua Cheat Sheet
-- Lua Cheat Sheet for Programmers, by Al Sweigart http://coffeeghost.net
-- This cheat sheet is an executable Lua program.
--[[ This is
a multline comment]]
---[[ This is a neat trick. The first -- makes -[[ not a multiline comment.
print("This line executes.")
--]] The rest of this line is also a comment.
print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings.')
@doches
doches / AtlasTool.py
Created August 3, 2010 19:14
A tool for creating texture atlases
import os
import pygame
import re
import sys
from pygame.locals import *
from optparse import OptionParser
parser = OptionParser(usage="AtlasTool is a utility for packing multiple images into a single OpenGL texture (a texture atlas).\n\npython %prog [options]")
parser.add_option("-d","--dir",dest="dir",help="(REQUIRED) Path to a directory containing desired texture images.")
parser.add_option("--surface",dest="surface_size",help="Size of the surface into which to render, of the form WIDTHxHEIGHT). Defaults to 512x512.",default="512x512")
@doches
doches / gist:504953
Created August 2, 2010 17:03
Example C++ Header/Code files
// object.h (the header file)
#include <iostream>
class H
{
public:
H(int v);
void print();
protected:
int value;
@doches
doches / game_of_life.rb
Created June 28, 2010 16:00
Implements Conway's Game of Life
# Monkey patch to add .x/.y shorthand and wrapping positive indices to Array
class Array
# Lets me reference arrays as <array>.x/<array>.y for readability.
def x; self[0]; end
def y; self[1]; end
# Replace Array#[] with a version that wraps positive indices
alias :old_get :[]
def [](a,b=nil)