Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Mike Clark wassname

🙃
View GitHub Profile
@wassname
wassname / fbmtimelinecleaner.js
Created Jun 8, 2014
Facebook Mobile Timeline Cleaner. Take back control of your Facebook Timeline with this activity log scrubber! This script deletes your facebook comments/posts/likes etc.
View fbmtimelinecleaner.js
// ==UserScript==
// @name Facebook Mobile Timeline Cleaner
// @namespace https://github.com/wassname/fbmtimelinecleaner
// @include https://*m.facebook.com/*/allactivity*
// @require http://code.jquery.com/jquery-1.8.3.min.js
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @version 0.40
// ==/UserScript==
View 1README.md

3Dflex.py

A script for calculating 3D flexure in python. Converted from GARRY QUINLAN's fortran program 3dflex.f.

This programme calculates the flexure for 3D elastic sheet where the sheet can have one of its 4 edges as a free edge. It uses a finite difference approach to the 3D flexure problem and lets Te, restoring force and ;loading vary in a random fashion. There are many comments written in the program to guide the user through.

INPUT:

@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 / read_zmapplus.py
Created Jun 8, 2014
python function to read zmap plus asci grid format
View read_zmapplus.py
def read_zmapplusgrid(inputfile,dtype=np.float64):
"""Read ZmapPlus grids
Format is explained here http://lists.osgeo.org/pipermail/gdal-dev/2011-June/029173.html"""
# read header, read until second '@', record header lines and content
infile = open(inputfile,'r')
comments=[]
head=[]
a=0 # count '@'s
headers=0 # cound header+comment lines
@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 / scrape_Wikipedia_tables.py
Last active Jan 22, 2021
Scrape a table from wikipedia using python. Allows for cells spanning multiple rows and/or columns. Outputs csv files for each table
View scrape_Wikipedia_tables.py
# -*- coding: utf-8 -*-
"""
Scrape a table from wikipedia using python. Allows for cells spanning multiple rows and/or columns. Outputs csv files for
each table
url: https://gist.github.com/wassname/5b10774dfcd61cdd3f28
authors: panford, wassname, muzzled, Yossi
license: MIT
"""
from bs4 import BeautifulSoup
@wassname
wassname / SnowCastleStemmer.py
Last active Apr 8, 2019
A wrapper around the nltk snowball stemmer with a reverse lookup table
View SnowCastleStemmer.py
import ntlk
class SnowCastleStemmer(nltk.stem.SnowballStemmer):
""" A wrapper around snowball stemmer with a reverse lookip table """
def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs)
self._stem_memory = defaultdict(set)
# switch stem and memstem
self._stem=self.stem