Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Mike Clark wassname

🙃
View GitHub Profile
@wassname
wassname / get_nz_strat_names.py
Created Jun 8, 2014
Simple python script to scrape all geological names from the New Zealand Stratigraphic Lexicon
View get_nz_strat_names.py
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
# python script to scrape all geo names from http://data.gns.cri.nz/stratlex/view.jsp?id=981&page=1
# ~7205 pages so for each id
# on each page get
# <td class="lighter">NAME​/td>â€
# add it to a list and output list as a textfile.dic with on word to a line
@wassname
wassname / minecraft_id_help.md
Last active Aug 29, 2015
PYTHON SCRIPT TO FIX BLOCK-ID COLLISIONS
View minecraft_id_help.md

What is it?

This is a python script to help with block conflicts in minecraft. It looks at all the files in your tekkit config directory and find and resolved block-id issues. It does this by finding lines that start with a "I:" or "B:" that have numbers between 159 and 4096. It makes a note of collisions and you can set it to auto-resolve them but it might get it wrong.

It worked for me... but it set some of my dimensional door values too high and I had to manually change them. Still... it saved me a lot of time, and might be useful to someone who knows python or deals with block-id collisions lots.

How to use?

  1. Download the file from the pastebin link http://pastebin.com/Z8at076h 1 Make sure python is installed (with numpy). 2 Make a backup of your config file. 3 Put the file in your .mincraft or .techniclauncher\tekkit directory (1 above the config directory)
@wassname
wassname / model_emplacement_heat.py
Last active Aug 29, 2015
Model and graph heatflow resulting from an emplacement for varying time before present and depth below msl of emplacment
View model_emplacement_heat.py
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 16 20:03:59 2014
This will generate a schematic of heat vs depth vs time for difference emplacement times
@author: wassname
"""
import numpy as np
from numpy import pi, sin, cos, exp
@wassname
wassname / simplify_polygon_perpdist.py
Created Jul 12, 2015
Simplify a polygon using perpendicular distance
View simplify_polygon_perpdist.py
# -*- coding: utf-8 -*-
"""
Simplify a polygon using perpendicular distanc, see help(simplify_perp_dist)
"""
import numpy as np
import pylab
def simplify_perp_dist(M, trgt_points = np.inf):
"""
@wassname
wassname / isLineOpenToSea.py
Last active Aug 29, 2015
Is a line open to the sea
View isLineOpenToSea.py
"""
Determine if a line is open to sea by using aspect derived from a digital
elevation model, and comparing to line angle and the change in line angle.
It works like this, if we are turning in the same direction as downhill then it is concave.
The magnitude of concavity is the component of the downhill direction that is perpendicular to direction
Then we do an average of concavity over the whole line, weighted by segment length
"""
import numpy as np
@wassname
wassname / moveToXYZ.js
Created Nov 13, 2015
moveToXY for the Phaser Isometric Plugin
View moveToXYZ.js
/**
* Move the given display object towards the x/y coordinates at a steady velocity.
* If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
* Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms.
* Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
* Note: The display object doesn't stop moving once it reaches the destination coordinates.
* Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all)
*
* @method Phaser.Physics.IsoArcade#moveToXY
* @param {any} displayObject - The display object to move.
@wassname
wassname / get_ucwa_tokens.js
Last active Dec 18, 2015
Uses casperjs or ghost.py to get lync api tokens from https://ucwa.skype.com/login/explore
View get_ucwa_tokens.js
/*
* Uses casperjs to get api tokens from https://ucwa.skype.com/login/explore
*
* @outputs:
* this will output ucwaTokens.json to current directory
*
* If debug is true, then it will output screenshots to ./debug-images/<name>.png
*
*
* @run
@wassname
wassname / Dockerfile
Last active Dec 26, 2015
optional apt-get caching for docker
View Dockerfile
# configure apt to not install reccomendations
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends
RUN apt-get update \
&& apt-get install -y netcat \
&& rm -rf /var/lib/apt/lists/*
# This uses the apt proxy only if present. It checks on port 3142 of the host/gateway, and returns DIRECT for no proxy,
@wassname
wassname / placeAboveOverlaps.js
Last active Dec 26, 2015
For Phaser.Plugin.IsoArcarde, this helps displayObject placement by moving it above others. This is done by moving them up until they no longer overlap with anything.
View placeAboveOverlaps.js
/*
* For Phaser.Plugin.IsoArcard, this helps displayObject placement by moving it above others. This is
* done by moving them up until they no longer overlap with anything.
* @method Phaser.Physics.IsoArcade#placeAboveOverlaps
* @param {any} displayObject - The display object to move.
* @param {any} groupCollision - The the group of displayObjects to check for overlaps with.
* @param {number} [startZ=displayObject.isoZ] - The speed it will move, in pixels per second (default is 60 pixels/sec)
*/
function placeAboveOverlaps(displayObject,groupCollision,startZ){
var overlap
@wassname
wassname / docker-machine-hostnames.sh
Created Jan 15, 2016
Bash script to update hostfile to mache docker-machines
View docker-machine-hostnames.sh
#!/bin/bash
sethost () { # set up docker hostnames
# replace everything in line with the right IP, with $IP $MACHINE
D_MACHINE=$1
echo "Update host file for machine=$D_MACHINE"
DATE=$(date -u +%s)
echo "backing up hosts to /tmp/hosts-$(date -u +%s)"
cp /etc/hosts /tmp/hosts-$(date -u +%s)