Skip to content

Instantly share code, notes, and snippets.

View wassname's full-sized avatar
🙃

Michael J Clark wassname

🙃
View GitHub Profile
@wassname
wassname / fbmtimelinecleaner.js
Created June 8, 2014 02:34
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.
// ==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==
@wassname
wassname / 1README.md
Last active March 13, 2018 12:35
3Dflex.py

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 June 8, 2014 21:30
Simple python script to scrape all geological names from the New Zealand Stratigraphic Lexicon
#!/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 August 29, 2015 14:02
PYTHON SCRIPT TO FIX BLOCK-ID COLLISIONS

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 August 29, 2015 14:02
Model and graph heatflow resulting from an emplacement for varying time before present and depth below msl of emplacment
# -*- 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 June 8, 2014 21:45
python function to read zmap plus asci grid format
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 July 12, 2015 04:20
Simplify a polygon using perpendicular distance
# -*- 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 August 29, 2015 14:24
Is a line open to the sea
"""
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 October 25, 2023 08:28
Scrape a table from wikipedia using python. Allows for cells spanning multiple rows and/or columns. Outputs csv files for each table
# -*- 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 April 8, 2019 08:52
A wrapper around the nltk snowball stemmer with a reverse lookup table
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