Skip to content

Instantly share code, notes, and snippets.

View mbainrot's full-sized avatar

Max Bainrot mbainrot

  • Canberra, Australia
View GitHub Profile
@mbainrot
mbainrot / setalltrackwidth.py
Created December 7, 2020 08:53
kicad pcbnew python set all track width
board = pcbnew.GetBoard()
tracks = board.GetTracks()
targetWidth = 300000 # 300000 = 0.3 mm
for track in tracks:
track.SetWidth(targetWidth)
@mbainrot
mbainrot / main.c
Last active April 16, 2018 08:09
How I got serial working on a PIC18F2550
/*
* File: main.c
* Author: max
*
* Created on April 14, 2018, 10:40 AM
*/
// Set the OSC to internal osc which is 8 MHz
#pragma config FOSC = INTOSC_EC
#pragma config WDT = OFF // turn off watch dog
@trisharia
trisharia / executeTransientRESTOperation.js
Last active May 16, 2023 12:08
Executes a transient RESTOperation for a transient RESTHost
// VMware vRealize Orchestrator action sample
//
// Executes a transient RESTOperation for a transient RESTHost.
// Performs the operation without having the operation nor the host persist in the RESTHost Inventory.
// Returns the response string and status code as named key-value pairs "responseString" and "statusCode", respectively.
//
// For vRO 7.0+
//
// Action Inputs:
// baseUrl - string - Base URL for connecting to the RESTful application
@whatnick
whatnick / Energy_Monitor_Real.ino
Last active October 1, 2022 20:10
ESP8266 Energy Monitor Real Power
/*
* This sketch sends ads1115 current sensor data via HTTP POST request to thingspeak server.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
*
* designed to run directly on esp8266-01 module, to where it can be uploaded using this marvelous piece of software:
*
* https://github.com/esp8266/Arduino
*
@mbainrot
mbainrot / cron
Last active August 29, 2015 14:22
Timelapse Script
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
#!/bin/bash
# For use with ubuntu 14.04 LTS, might work for ubuntu 14.10 though ymmv
add-apt-repository ppa:mapnik/boost
apt-get update
apt-get install libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
apt-cache policy libboost-dev
@CapnKernel
CapnKernel / stencil.py
Created April 7, 2015 09:33
Generating a stencil border
# -*- coding: utf-8 -*-
from decimal import Decimal
from copy import copy
from django.shortcuts import render
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .forms import StencilBorderForm
@mbainrot
mbainrot / etc init.d home_automation
Last active August 29, 2015 14:18
Make a python + virtualenv run as a service
#!/bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@ekarulf
ekarulf / code128.py
Created November 16, 2010 04:25
Code128 Python Generator (Uses PIL)
#!/usr/bin/env python
# Copyright (c) 2010 Erik Karulf (erik@karulf.com)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR