Skip to content

Instantly share code, notes, and snippets.

View evansims's full-sized avatar

Evan Sims evansims

View GitHub Profile
@evansims
evansims / keybase.md
Last active August 29, 2015 14:05
keybase.md

Keybase proof

I hereby claim:

  • I am evansims on github.
  • I am evansims (https://keybase.io/evansims) on keybase.
  • I have a public key whose fingerprint is 4F5E C6AC A591 2B02 65AC 2D7C B970 6FBE 74F6 A3EA

To claim this, I am signing this object:

@evansims
evansims / gist:210f9a9bc7d42b0ad299
Created November 2, 2014 02:05
Re-encode a WAV to MP3 using ffmpeg, stripping metadata and reducing volume.
ffmpeg -i filename.wav -map_metadata -1 -vol 128 filename.mp3
@evansims
evansims / backup.sh
Created June 1, 2011 20:33
Nightly Backup Script
#!/bin/bash
mysqlUser="MYSQL USER"
mysqlPass="MYSQL PASSWORD"
backup="/path/to/backups/"
folders[0]="/home/user1/"
folders[1]="/home/user2/"
folders[2]="/var/lib/mongodb/"
@evansims
evansims / backup_mysqld.sh
Created March 5, 2012 15:17
Backup Databases to Individual ZIPs
#!/bin/bash
mysqlUser=""
mysqlPass=""
backup="/home/username/mysqldump"
databases=( $(mysql -u"$mysqlUser" -p"$mysqlPass" --skip-column-names --batch -e "show databases;" 2>"$temp") );
echo "found ${#databases[@]} databases.";
for i in ${databases[@]}; do
@evansims
evansims / Prerequisites
Created November 13, 2012 01:26
SQL Backups0rz
apt-get install pigz
@evansims
evansims / WilsonConfidenceIntervalCalculator.php
Created April 10, 2017 23:03 — forked from mbadolato/WilsonConfidenceIntervalCalculator.php
PHP translation of the Wilson ConfidenceInterval Calculator. Ported from Ruby and uses a hardcoded (pre-calculated) confidence (z value) instead of a dynamic calculation with a translation of Ruby's Statistics2.pnormaldist method. Since z doesn't change once it's computed, nor is the computation dependant on the passed-in values, calculating it …
<?php
/*
* (c) Mark Badolato <mbadolato@gmail.com>
*
* This content is released under the {@link http://www.opensource.org/licenses/MIT MIT License.}
*/
namespace Bado\ScoreCalculator;
@evansims
evansims / hooks.php
Last active May 20, 2020 19:27
An example of automatically including header and footer templates using Slim hooks.
$app->hook('slim.before.dispatch', function () use ($app) {
$app->render('/views/header.php');
});
$app->hook('slim.after.dispatch', function () use ($app) {
$app->render('/views/footer.php');
});
@evansims
evansims / Octagon
Created April 21, 2019 21:33
Monokai Pro Slack Theme
#1E1F2B,#1E1F2B,#282A3A,#FFD76D,#1E1F2B,#9A9DA7,#95E18A,#F47777
@evansims
evansims / script.js
Last active February 16, 2023 00:43
Google Apps Script: Sync Google Group members Out of Office events to a shared calendar, including recurring OOF events, using the outOfOffice eventType.
/**
This is based on the example provided at:
https://developers.google.com/apps-script/samples/automations/vacation-calendar
The following changes were made:
- Uses the outOfOffice eventType to identify events to sync. It does not use a keyword search.
- Events use the full names of members, pulled from the Google Workspace API (AdminDirectory.)
- Recurring OOF events are supported.
- Creates "shadow events" instead of importing the actual events, to circumvent "forbidden" errors in some cases, and issues with recurring events.
@evansims
evansims / example.html
Last active February 5, 2024 16:52
Embedding or sharing a image or photo uploaded to Google Drive.
<a href="https://drive.google.com/uc?export=view&id=XXX"><img src="https://drive.google.com/uc?export=view&id=XXX" style="width: 500px; max-width: 100%; height: auto" title="Click for the larger version." /></a>