Skip to content

Instantly share code, notes, and snippets.

Mike Lloyd mxplusb

View GitHub Profile
View feature-as-you-go.py
import matplotlib.pyplot as plt
import numpy as np
PRICE_SHEET = {
"scale_amount": 1000,
"base_price": 1,
"feature_x": 0.1,
"feature_y": 0.15,
"feature_z": 0.20,
}
@mxplusb
mxplusb / syncer.py
Created Feb 5, 2019
Sync Credhub to Vault
View syncer.py
#!/usr/bin/env python3
import json
import logging
import os
import subprocess
import shlex
import sys
import hvac
@mxplusb
mxplusb / proc.go
Last active Jan 10, 2019
Background processes in Windows with Go.
View proc.go
package main
import (
"errors"
"fmt"
"golang.org/x/sys/windows"
"syscall"
"time"
"unsafe"
)
View bosh-27651.log
This file has been truncated, but you can view the full file.
I, [2018-11-09T18:02:39.370726 #16] [0x3f96308f4548] INFO -- TaskHelper: Director Version: 268.1.0
I, [2018-11-09T18:02:39.370833 #16] [0x3f96308f4548] INFO -- TaskHelper: Enqueuing task: 27651
I, [2018-11-09T18:02:40.115109 #5668] [] INFO -- DirectorJobRunner: Looking for task with task id 27651
D, [2018-11-09T18:02:40.116683 #5668] [] DEBUG -- DirectorJobRunner: (0.000459s) (conn: 47329200342920) SELECT * FROM "tasks" WHERE "id" = 27651
I, [2018-11-09T18:02:40.119102 #5668] [] INFO -- DirectorJobRunner: Found task #<Bosh::Director::Models::Task @values={:id=>27651, :state=>"processing", :timestamp=>2018-11-09 18:02:39 UTC, :description=>"create deployment", :result=>nil, :output=>"/var/vcap/store/director/tasks/27651", :checkpoint_time=>2018-11-09 18:02:39 UTC, :type=>"update_deployment", :username=>"admin", :deployment_name=>"cf", :started_at=>nil, :event_output=>"", :result_output=>"", :context_id=>""}>
View brew.sh
% brew config
HOMEBREW_VERSION: 1.8.0
ORIGIN: https://github.com/Linuxbrew/brew.git
HEAD: 8f5de98bcc40afe402969dff6794739979b00a09
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 91b560b3265e4c4377554c2d5cf315454f7ede17
Core tap last commit: 32 minutes ago
HOMEBREW_PREFIX: /home/mike/.linuxbrew
HOMEBREW_REPOSITORY: /home/mike/.linuxbrew
@mxplusb
mxplusb / azure_region_has_az_support.rb
Created Oct 19, 2018
Short script to test whether an Azure region has availability zone support.
View azure_region_has_az_support.rb
#!/usr/bin/env ruby
require 'azure_mgmt_compute'
Compute = Azure::Compute::Profiles::Latest::Mgmt
def generate_client
subscription_id = ENV['AZURE_SUBSCRIPTION_ID'] # your Azure Subscription Id
provider = MsRestAzure::ApplicationTokenProvider.new(
ENV['AZURE_TENANT_ID'],
@mxplusb
mxplusb / hashmap.go
Created Nov 14, 2017
Compute the size of a map in Golang.
View hashmap.go
// We're going to compute the actual size of the map, it's total memory footprint.
// In retrospect, we only need the keySize, but I like it, so I'll leave it.
func computeSize(theMap map[string]interface{}) (int, int, int) {
mapLen := uintptr(len(theMap))
baseSize := unsafe.Sizeof(hmapRef{}) + (mapLen * 8)
keySize := mapLen * 8 * unsafe.Sizeof(randKey(theMap))
valSize := mapLen * 8 * unsafe.Sizeof(theMap[randKey(theMap)])
totalSize := baseSize + keySize + valSize
return int(keySize), int(valSize), int(totalSize)
}
@mxplusb
mxplusb / config.txt
Last active Nov 9, 2017
Vyatta Configs
View config.txt
firewall {
all-ping enable
broadcast-ping disable
ipv6-receive-redirects disable
ipv6-src-route disable
ip-src-route disable
log-martians enable
name WAN_IN {
default-action drop
description "WAN to internal"
@mxplusb
mxplusb / wow-interface.txt
Last active Aug 17, 2018
My WoW interface.
View wow-interface.txt
A0UBEwAgKhUuEZVqllS3CNUuRdUwFMcIlqniGULTUOoakG1Q+QZU46Cqc1SyjqjkHVEpDhJVCyE9VFQmUqnURUo2KvKRkEaqKicVeokSyUyochOVnRA/pQxVsBRVPSVNVbqKyFaUiK9UKjpLpZK1KFFviUrpLkqk9oq/VMpgQjmMtJiKx6gyWZUuq2xG1GeijFaV04DXVKpmQ7kNlN1U/aYYrijLQc8pNV1yHcF2It9R0nii4jxKWK+q2k+II2SjLy3qUGhnoxQWQKa8ykbr5NRkIBit6ByJP1j8Ob7FRT/gvdGz5D6Ah13Q6HeA7KsgDxM1EDhftADjo7/GH1luyMrjRVmBt74gAsMwqejJmR0EzvMuG62TU5OBYLSicyT+YPHn+BYX/YD3Rs+S+wAedkGj3wGyr4I8TNRA4HzRAoyP/hp/ZLkhK48XZQXe+oIIDMOkop/xBmajdXJqMhCMVnSOxB8s/lz0A94bPUvuA3jYBY1+B8i+CvIwUQOB80ULMD76a/yR5YasPF6UFXjrCyIwDJOKwpsRihZgfDZ6njrYBY1+B8i+CvIw0Q94b/QsuQ/gYRc0aiBwvmgBxkd/jT+y3JCVx0ulojwChOdrCWUgQLEgrqiNXTYqD8EMZJGNjt6eHa+yUctTB7s4qejcRyHl1cFs1PLUwS5OKpWKghnpoJ2NDlfyaBRtu43jj6K/7RYmkcaBwvPV0bbbOP4o+tsujg+O688TtTCJNLnxKfByRjoY3TbgWdN2C5NI40Dh+epo220cnjVtZ3fQ80TxjlxzHy3OSAejaNttHJ41bSeNA4Xnq6Ntt3F41rSd6YIrihrbRglVxkfRttu4bmESaRwoPF8dbbuN60TX04kg8CjLxp+8A2BAsYiibbdx3cIk0jhQeL462nYb14kuYmc/xKiFSaTJjU+Bd3bFGelgdNuAZ03bLUwijQOF56ujbbdxeNa0nd3BibiohUmkyW0yPILNGelgFG27jesWJpHGgcLz1dG227hOdIG68BCjcxi1
View rest-arm.ps1
$StorageName = "pioneertest"
$ResourceGroup = "test-01"
$Location = "West US"
$SubscriptionName = ""
$OpsManURI = ""
# set global verbosity for all commands.
$PSDefaultParameterValues['*:Verbose'] = $true
Write-Host "Cleaning out old Resource Group."
Remove-AzureRmResourceGroup -Name $ResourceGroup -Verbose -Force
You can’t perform that action at this time.