Skip to content

Instantly share code, notes, and snippets.


Matt Aimonetti mattetti

View GitHub Profile
mattetti / multipart_upload.go
Last active Aug 12, 2022
Example of doing a multipart upload in Go (golang)
View multipart_upload.go
package main
import (
mattetti / gist:5104790
Created Mar 7, 2013
Ruby 2.0 module prepend example
View gist:5104790
# Not our code
class Action
def start
"just do it"
# The module including our modifying code
module RubyIt
def start
View gpm.bash
#!/usr/bin/env bash
set -eu
## The Godeps file is expected to have lines like so:
# v2.6
## where the first element is the import path and the second is a tag
## or commit SHA in the project.
mattetti / gist:1015948
Created Jun 9, 2011
some excel formulas in Ruby
View gist:1015948
module Excel
module Formulas
def pmt(rate, nper, pv, fv=0, type=0)
((-pv * pvif(rate, nper) - fv ) / ((1.0 + rate * type) * fvifa(rate, nper)))
def ipmt(rate, per, nper, pv, fv=0, type=0)
p = pmt(rate, nper, pv, fv, 0);
ip = -(pv * pow1p(rate, per - 1) * rate + p * pow1pm1(rate, per - 1))
(type == 0) ? ip : ip / (1 + rate)
mattetti /
Last active Mar 17, 2022
bash script to run from WSL to setup Windows and Linux from the linux side. To run: `wget -O` and then `bash`
export WINHOME=$(wslpath "$(wslvar USERPROFILE)")
# github username is needed to pull down the dot files
export GITHUBUSERNAME="mattetti"
# wininstall does an install using winget and checks that it went well
function wininstall {
echo "Installing $1";
cmd.exe /C winget.exe install -e $1;
mattetti / main.go
Created Jun 6, 2011
Go's reflection example
View main.go
package main
func main(){
// iterate through the attributes of a Data Model instance
for name, mtype := range attributes(&Dish{}) {
View iTunes.h
* iTunes.h
#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>
@class iTunesPrintSettings, iTunesApplication, iTunesItem, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesDevicePlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesTrack, iTunesAudioCDTrack, iTunesDeviceTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesPlaylistWindow;
mattetti / audioGenButton.cs
Created Oct 5, 2021
Unity script to generate and load an audio clip using Azure Cognitive Services
View audioGenButton.cs
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using Microsoft.CognitiveServices.Speech;
using Microsoft.CognitiveServices.Speech.Audio;
using System.IO;
using UnityEngine.Networking;
using System.Threading.Tasks;
mattetti / gist:3798173
Last active Sep 11, 2021
async fetching of urls using goroutines and channels
View gist:3798173
package main
import (
var urls = []string{
mattetti / tracepoint_middlware.rb
Created Mar 6, 2013
test middleware for Ruby 2.0 logging the method dispatches going on when a request is being handled.
View tracepoint_middlware.rb
class TracePoint
class Middleware
def initialize(app)
@app = app
def call(env)
stats = {}
trace = do |tp|