Skip to content

Instantly share code, notes, and snippets.

View Kromey's full-sized avatar
🦀

Travis Veazey Kromey

🦀
View GitHub Profile
@Kromey
Kromey / system_chain.rs
Created March 20, 2019 21:35 — forked from jaynus/system_chain.rs
pretty triangles
use crate::components;
use amethyst::ecs::{self, prelude::*, shred::ResourceId};
pub trait EventSystem<'a> {
type SystemData: ecs::SystemData<'a>;
type Event: Sized;
fn run(data: &Self::SystemData, event: &mut Self::Event) -> bool;
@Kromey
Kromey / rand.rs
Created March 1, 2019 19:00
Rust implementations of Xoshiro256**, PCG32, and a bonus SplitMix64
//! This is a direct port of these algorithms' respective
//! C implementations into Rust. I did this chiefly as a learning
//! exercise for myself, but after adopting the `wrapping_mul` and
//! `rotate_left` methods (which I discovered from looking at the
//! code in the `rand` crate) I ended up with essentially identical
//! implementations to what's in the popular `rand` crate. Also here
//! is a very quick-and-dirty main() that demonstrates some of the
//! functionality.
//!
//! See https://payloadgame.dev/devlog/2019/02/28/random-generators.html
@Kromey
Kromey / cf_dyndns.py
Last active October 5, 2017 23:06
Dynamic DNS via Cloudflare
#!/usr/bin/env python
import requests
import conf
url_base = 'https://api.cloudflare.com/client/v4{endpoint}'
@Kromey
Kromey / disk_wipe.sh
Last active May 11, 2017 20:39
This simple Bash script functions as a wrapper around dd, for the purpose of wiping a disk or partition while providing progress feedback to the user.
#!/bin/bash
# disk_wipe.sh
# Author: Kromey (http://kromey.us/)
# This simple Bash script leverages the dd utility to provide user feedback
# as progress is made, designed for the purpose of wiping hard drives or
# partitions. This script reads from /dev/zero to most efficiently zero-out
# the target device or partition.
#
# BEGIN CONFIG
#!/bin/bash
##########################################################################################
# Automated Let's Encrypt certificate renewals #
# #
# This script is designed to be run as often as desired, but will not renew certificates #
# until they are due to expire (by default 30 days ahead of expiry). #
# #
# This script expects that you've provided appropriate parameters in a cli.ini file, #
# either in /etc/letsencrypt/cli.ini or $XDG_CONFIG_HOME/letsencrypt/cli.ini; note that #
@Kromey
Kromey / .pypirc
Last active November 14, 2015 00:52
A basic build script for PyPi packages that checks your description for parsing errors first
#Put in your home directory
[distutils]
index-servers=pypi
[pypi]
repository = https://pypi.python.org/pypi
username = <username>
password = <password>
#!/bin/bash
#####
# db_backup.sh
# This script is intended to run nightly and makes SQL dumps of each of your
# MySQL and PostgreSQL databases.
#
# Prerequisites:
# * You must have a database user in each server with proper privileges:
# * MySQL: SELECT, RELOAD, LOCK TABLES, and EVENTS on each database