Skip to content

Instantly share code, notes, and snippets.

{
"handler": "Microsoft.Compute.VmExtension",
"version": "0.1.2-preview",
"parameters": {
"elements": [
{
"name": "tenant",
"type": "Microsoft.Common.TextBox",
"label": "Environment ID",
"toolTip": "Your Dynatrace environment ID.",
@fitzgeraldsteele
fitzgeraldsteele / get_azure_vm_sizes.py
Created January 20, 2018 01:57
Get a list of Azure VM Skus for a particular Azure region
# Get a list of Azure VM Skus for a particular region
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.compute import ComputeManagementClient
client = get_client_from_cli_profile(ComputeManagementClient)
SUBID = 'YOUR-SUBSCRIPTION-ID'
LOCATION = 'eastus2'
@fitzgeraldsteele
fitzgeraldsteele / net-promoter-score.py
Created November 7, 2013 21:13
A little python function to calculate the net promoter score from a list of ratings. Also wanted to practice doctests.
#!/usr/bin/env python
import sys
def netpromoterscore(scores):
"""
Calculates the netpromoter score of a list
The Net Promoter Score is obtained by asking customers a single question on a 0 to 10 rating scale:
'How likely is it that you would recommend our company to a friend or colleague?'
Based on their responses, customers are categorized into one of three groups:
Promoters (9-10 rating), Passives (7-8 rating), and Detractors (0-6 rating).
@fitzgeraldsteele
fitzgeraldsteele / bootstrap.icon.divs
Created May 9, 2012 17:39
In the bootstrap framework, you make icons using a custom <i> tag. But some tools (ahem, Sitefinity CMS) like to autocorrect your HTML, so it doesn't play nicely with the <i> tag. But you can use a DIV too.
<div class="close icon-remove" data-dismiss="modal"></div>
@fitzgeraldsteele
fitzgeraldsteele / css3test.html
Created March 21, 2011 05:30
css3 test: opacity, transition, reflection, transform
<DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>csstest</title>
<style type="text/css" media="screen">
img:hover {border:#CCC 2px solid;
opacity:1.0;
-webkit-transition:opacity 1s ease-in;
@fitzgeraldsteele
fitzgeraldsteele / findandzip.sh
Created December 20, 2010 14:15
Find files matching regular expressions in a directory tree, compress them into a tar/gzipped file
find -X . -name "*201009*" -o -name "*201010*" -o -name "*201011*" | xargs tar czvf ~/Desktop/corplogs.tgz
@fitzgeraldsteele
fitzgeraldsteele / fadeout_work_fadein.js
Created October 21, 2010 04:06
A simple jQuery animation snippet that fades an element, does some work on it, and then fades in
$('#link').click(function(
$('#content_container').fadeOut("fast",function() {
updatePage();
//other code here
}).fadeIn();
);
$(function(){
$('#jqt').ajaxComplete(function(){
add_ga(); // add google analytics on each page load
});
$(document).ready(function() {
add_ga(); // add google analytics to the first page
});
function add_ga() {
import simplejson
import urllib2
r = urllib2.urlopen('http://friendfeed.com/api/feed/room/science21')
json = simplejson.loads(r.read())
# I just want to look at the entries in the room
e = json['entries']
#!/usr/bin/env python
''' Downloads all enclosed mp3s from http://yearofmixtapes.blogspot.com '''
import subprocess
import feedparser # http://feedparser.org
d = feedparser.parse("http://feeds.feedburner.com/myyearofmixtapes")
enclosures = [x.enclosures[0] for x in d.entries if x.enclosures]
mp3_urls = [m['href'] for m in enclosures if m['type'] == 'audio/mpeg']