Blog post: https://segmentfault.com/a/1190000017136059
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### JHW 2018 | |
import numpy as np | |
import umap | |
# This code from the excellent module at: | |
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import pprint | |
def displayhook_pprint(o): | |
"""Display hook powered by pprint. | |
https://www.python.org/dev/peps/pep-0217/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See: https://github.com/dabeaz/sly | |
from sly import Lexer, Parser | |
class CalcLexer(Lexer): | |
tokens = { | |
'NAME', 'NUMBER', | |
} | |
ignore = ' \t' | |
literals = { '=', '+', '-', '*', '/', '(', ')' } |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import geopandas | |
from helpers import width, peak_flow | |
def flow_column_name(return_period): | |
return "Q{:d}".format(int(float(return_period) * 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
from wrapt import ObjectProxy | |
class Callable(ObjectProxy): | |
def __call__(self, *args, **kwargs): | |
result = self.__wrapped__ | |
if 'upper' in kwargs: | |
result = result.upper() | |
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shapely.geometry import Point, LineString, Polygon, GeometryCollection, MultiLineString | |
from shapely.ops import polygonize, unary_union, nearest_points | |
from shapely.wkt import loads as load_wkt | |
def split_polygon_line(polygon, line): | |
"""Split a Polygon with a LineString""" | |
assert(isinstance(polygon, Polygon)) | |
assert(isinstance(line, LineString)) | |
boundary = polygon.boundary | |
union = boundary.union(line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# tile_georef.sh | |
# | |
# Grab an mapbox ZYX tile and save as a geotiff with geoferencing | |
# tile_georef.sh 13 4168 3197 mapbox.satellite output.tif | |
# | |
set -u |
NewerOlder