Skip to content

Instantly share code, notes, and snippets.

View withinboredom's full-sized avatar
🏠
Working from home

Rob Landers withinboredom

🏠
Working from home
View GitHub Profile
@withinboredom
withinboredom / create.sh
Last active December 23, 2015 20:19
Create Attachments
#!/bin/bash
echo "Installing utilities"
aptitude update
aptitude install xfsprogs mdadm
read -n 1
echo "Creating drives"
for x in {1..4}; do
ec2-create-volume -C /home/ubuntu/.aws/cert-BFUJDRVUAIJYVUVJHHUPWS423TEXFAX6.pem -K /home/ubuntu/.aws/pk-BFUJDRVUAIJYVUVJHHUPWS423TEXFAX6.pem --size 128 --region eu-west-1 -z eu-west-1a;
@withinboredom
withinboredom / cleaner.php
Created June 7, 2014 05:39
Moving wordpress
$read = fopen("db513204537.sql", 'r');
$write = fopen("scrubbed.sql", "w");
$on = 0;
while($line = fgets($read)) {
$on++;
// change site url
$line = str_ireplace("verbatl.com", "verb.azurewebsites.net", $line);
@withinboredom
withinboredom / delete-em.ps1
Created June 9, 2014 03:14
Deletes a file if over a certain size
#pick your file
$Dir = "F:\MyDir\stuff.cache"
#Max size in megs (gig = 1024 megs
$SizeMax = 1024
#get's the size in mb of the file(s)
$Size = (Get-ChildItem $Dir| Measure-Object -property length -sum)
# convert it to megs
var summer = function(old_sum, old_input) {
return old_sum + (old_input % 10);
}
var reducer = function(old_input) {
return old_input / 10;
}
var calculateSum = function(input) {
var sum = 0;
@withinboredom
withinboredom / aliases.ini
Last active July 12, 2019 18:33
Rob's Aliases
[alias]
# most commonly used
co = checkout
d = diff --color-words
cam = commit -a -m
upm = !git fetch upstream && git merge upstream/master
up = add -up
# least used
br = branch -a
@withinboredom
withinboredom / paasreqs.md
Last active August 29, 2015 14:15
PaaS Requirements

Must Haves

Ops

  • Manageable from any machine
  • Deployable from any machine
  • Be distributed and self healing
  • Simple to bootstrap, and fast

Development

  • As simple as pushing my code to deploy
@withinboredom
withinboredom / long_load.js
Created April 2, 2015 01:43
Loading a really big js file while providing user feedback via a progress bar
(function() {
var totalcss = 0;
var totaljs = 0;
var loadedjs = 0;
var loadedcss = 0;
var hasCss = false;
var hasJs = false;
var doStyle = function() {
var src = cssxhr.responseText;
var head = document.head || document.getElementsByTagName('head')[0];
@withinboredom
withinboredom / todo.mnk
Last active August 29, 2015 14:18
someday, you can compile this
gsd.todoList.todo <- aggregate
thingTodo <- value
done <- value
deleted <- value
markedComplete <- event
guard:
if @done != false
emit Failure
else
emit Success
@withinboredom
withinboredom / winner.js
Last active August 29, 2015 14:18
Winning Auctions
(function() {
var checkBid = true;
// run a function if the bid button is
var isButtonEnabled = function(callback) {
console.log('checking for new bids');
// if the place bid button is not disabled and we are ok to check a bid
if (!$('.place-bid').hasClass('disabled') && checkBid) {
// make it so we won't place a bid twice
checkBid = false;
@withinboredom
withinboredom / iframe-scraper.js
Last active August 29, 2015 14:20
a dumb js scraper using iframes
(function() {
var items = [];
window.inventory = [];
window.errors = [];
Array.prototype.clean = function(deleteValue) {
for (var i = 0; i < this.length; i++) {
if (this[i] == deleteValue) {
this.splice(i, 1);