Skip to content

Instantly share code, notes, and snippets.

View MIchaelMainer's full-sized avatar

Michael Mainer MIchaelMainer

View GitHub Profile
@MIchaelMainer
MIchaelMainer / download.ps1
Created August 7, 2018 23:38
Download and save file with PowerShell
$url = "https://graph.microsoft.com/beta/`$metadata"
$liveMetadataSavePath = "beta_2018_08_07.xml"
$client = new-object System.Net.WebClient
$client.Encoding = [System.Text.Encoding]::UTF8
$client.DownloadFile($url, $liveMetadataSavePath)
@MIchaelMainer
MIchaelMainer / Set and get values - 1.yaml
Last active February 8, 2018 01:02
Set and get values and formulas for a range - Shared with Script Lab
name: Set and get values - 1
description: Set and get values and formulas for a range
author: MIchaelMainer
host: EXCEL
api_set: {}
script:
content: |
$("#setup").click(setup);
$("#set-value").click(setValue);
@MIchaelMainer
MIchaelMainer / Set and get values - 1.yaml
Created February 7, 2018 21:50
Set and get values and formulas for a range - Shared with Script Lab
name: Set and get values - 1
description: Set and get values and formulas for a range
author: MIchaelMainer
host: EXCEL
api_set: {}
script:
content: |
$("#setup").click(setup);
$("#set-value").click(setValue);
@MIchaelMainer
MIchaelMainer / AzureMinecraft.sh
Last active January 21, 2018 09:02
Setup Minecraft
# Copied from https://github.com/gbowerman/azure-minecraft/blob/master/azure-marketplace/minecraft-server-ubuntu/install_minecraft.sh
#!/bin/bash
# Custom Minecraft server install script for Ubuntu 15.04
# $1 = Minecraft user name
# $2 = difficulty
# $3 = level-name
# $4 = gamemode
# $5 = white-list
# $6 = enable-command-block
################################################################################
#
# Credit to Sergey Babkins
# https://blogs.msdn.microsoft.com/sergey_babkins_blog/2016/12/31/how-to-pretty-print-xml-in-powershell-and-text-pipelines/
function Format-Xml {
<#
.SYNOPSIS
Format the incoming object as the text of an XML document.
#>
@MIchaelMainer
MIchaelMainer / DetectMIMEtype.js
Created January 4, 2016 21:49
WordJS doesn't return MIME type for images. I need to detect that for inserting images into the HTML canvas.Here are some links and code I started to work on when researching how to do this.
// http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript, thank you Jeremy Banks
function createBlob(base64EncodedImage) {
var myString = base64EncodedImage.value.slice(0);
// This goes into the WordJS library.
var byteCharacters = window.atob(myString);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
@MIchaelMainer
MIchaelMainer / .bashrc
Last active December 4, 2016 12:23
Bash setup. Alias for git commands, easy chooser for repos, cd shortcuts, open current repo in browser
# Set the default path.
ppath="/c/repos" #TODO - change to your repo dir
# openInRepoDir() { cd $ppath ; }
###### Alias #####
### Git; this should probably go into the .gitconfig
alias gs='git status -s'
alias cma='git commit -a -m'
alias cm='git commit -m'
alias r='git remote -v'