Skip to content

Instantly share code, notes, and snippets.

View themartorana's full-sized avatar

Dave Martorana themartorana

View GitHub Profile
@themartorana
themartorana / random.cs
Last active April 23, 2023 21:57 — forked from jakeobrien/gist:5503948
Flyclops Domino! Bone Randomization Code
// for Unity (C#)
public static void Shuffle<T>(this List<T> list)
{
System.Random rnd = new System.Random();
int n = list.Count;
while (n > 1) {
n--;
int k = rnd.Next(n + 1);
T obj = list[k];
list[k] = list[n];
@themartorana
themartorana / staged.js
Created December 14, 2017 15:09
Auto-management of receipts and shipping notifications
function handleStaged() {
Logger.log("Starting...")
handleStagedShipping();
handleStagedReceipts();
Logger.log("Done.")
}
function handleStagedReceipts() {
var getLabel = GmailApp.getUserLabelByName('_Stage/Receipts');
var setLabel = GmailApp.getUserLabelByName('Receipts');
@themartorana
themartorana / fastlyMonthToDateBill.py
Last active May 13, 2020 19:07
Calculate your month-to-date bill from Fastly with the billing API
# Requires Python 3
import requests
import locale
from typing import Dict, Tuple, List
from calendar import monthrange
from datetime import datetime
FASTLY_URL = "https://api.fastly.com/stats/usage_by_month?billable_units=true"
@themartorana
themartorana / anything_really.sh
Created August 2, 2012 19:31
Time your shell scripts
#!/bin/sh
START=`date +%s%N`
# Do stuff here
END=`date +%s%N`
ELAPSED=`echo "scale=8; ($END - $START) / 1000000000" | bc`

Keybase proof

I hereby claim:

  • I am themartorana on github.
  • I am davemartorana (https://keybase.io/davemartorana) on keybase.
  • I have a public key ASA6AcWSpUfxXC-hMBcdPNcogPZWtQkG8nsT0184Z9GLNgo

To claim this, I am signing this object:

@themartorana
themartorana / clock.js
Last active June 22, 2016 18:53
Make the Archilovers clock on the Inspiration tab sweeping seconds.
// Here You can type your custom JavaScript...// Clock
function clock() {
var clockSeconds = document.getElementById('clock-seconds'),
clockMinutes = document.getElementById('clock-minutes'),
clockHours = document.getElementById('clock-hours');
function getTime() {
requestAnimationFrame(getTime);
@themartorana
themartorana / dogstatsd
Created May 5, 2016 16:48
dogstatsd rc.d file
#!/bin/sh
# $FreeBSD$
# PROVIDE: dogstatsd
# KEYWORD: shutdown
. /etc/rc.subr
name=dogstatsd
rcvar=${name}_enable
@themartorana
themartorana / mailplane.css
Created October 16, 2012 15:24
MailPlane Style Customization CSS
/* gmail-refreshest: a custom gmail css by @roycifer */
/* some button styles borrowed from twitter bootstrap */
/* @match mail.google.com */
body, td, input, textarea, select {font-family:"Helvetica Neue",helvetica,arial,sans-serif;}
.w-asV > .nH:last-child {display: none;}
.w-asV > .nH > .no , #gbx1, #gbx2{background-image: -webkit-linear-gradient(top,white,#F7F7F7);}
.w-as1.nr{height:27px;border-radius:3px;}
.gbeti#gb .gbqldr, .gbet#gbqlw .gbqldr, .gbesi#gb .gbqldr, .gbes#gbqlw .gbqldr{max-height:35px;margin-top:3px;}
.gbqfqw{border-radius:3px;}
#!/bin/sh
START=`date +%s`
# Do stuff here
END=`date +%s`
ELAPSED=$(( $END - $START ))
★★★★★ We heard your feedback - Domino! Free now has less ads! Next update will have even fewer. Upgrade to the paid version to get rid of ads forever! ★★★★★
The reviews are in!
* "Crazy addictive!" - adjote
* "Best Domino game out there." - redvision4
* "Only issue is that it is completely addictive!" - Name_me
* "Players who enjoy a game of dominoes should give this one a try" - 148apps.com
* "Simply awesome." - Angel Pizarro