Skip to content

Instantly share code, notes, and snippets.

View ehoppmann's full-sized avatar

Emma Hoppmann ehoppmann

View GitHub Profile
@ehoppmann
ehoppmann / remove_google_ads.js
Created January 6, 2022 19:54
Remove google text adds tampermonkey userscript
// ==UserScript==
// @name Google AdSense Ads Remover
// @namespace https://gist.github.com/ehoppmann
// @description Removes Google ads from its search results
// @icon https://www.google.com/adsense/start/images/favicon.ico
// @author ehoppmann
// @copyright 2021, ehoppmann (https://gist.github.com/ehoppmann)
// @license MIT
// @version 0.1
// @supportURL
@ehoppmann
ehoppmann / Workarounds for Netflix and the blocking of IPv6 tunnels.md
Last active November 20, 2021 16:38 — forked from jamesmacwhite/Workarounds for Netflix and the blocking of IPv6 tunnels.md
Prevent proxy/VPN streaming error messages from Netflix when using a Hurricane Electric IPv6 tunnel.

Workarounds for Netflix and the blocking of Hurricane Electric IPv6 tunnels

The dreaded "You seem to be using an unblocker or proxy." error message. Cool story bro.

This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.

Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.

The problem

Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi

@ehoppmann
ehoppmann / gist:0b10bcaa1e793f757d1caddbd7ec2300
Last active March 14, 2024 09:00 — forked from rkkoszewski/gist:aa531cee7126edf329b76bdd0546f502
Notes for installing XorgXrdp and Xrdp with GLAMOR support
THIS ARE MY NOTES OF BUILDING AN INSTALLING XORGXRDP AND XRDP WITH GPU ACCELERATION
TESTED ON UBUNTU 20.04.2 with amdgpu (all-open variant) driver and FirePro W4100 GPU
-- Build XorgXrdp with GPU acceleration ("script" - to be adjusted to your needs) : --
## << BUILD AND INSTALL SCRIPT START >> ##
#!/bin/bash
# Install Latest XRDP with XORGXRDP
# README
@ehoppmann
ehoppmann / self_restarting_python_script.py
Created June 25, 2020 15:58
A python script that restarts itself (running a new process that reflects any changes on disk)
#!/usr/bin/env python3
# based on https://github.com/cherrypy/cherrypy/blob/0857fa81eb0ab647c7b59a019338bab057f7748b/cherrypy/process/wspbus.py#L305
import sys
import os
import time
_startup_cwd = os.getcwd()
def _do_execv():
args = sys.argv[:]
@ehoppmann
ehoppmann / slacktheme.md
Created June 18, 2019 19:24 — forked from thibmaek/slacktheme.md
Slack Color Schemes

Kimbie

#F3E3CD,#F3E3CD,#F3951D,#DA3D61,#F26328,#183E1C,#DA3D61,#F26328 screen

Monokai

#222222,#2F2F2F,#F92772,#FFFFFF,#A6E22D,#FFFFFF,#66D9EF,#BE84F2 screen

Juice Bar

#86A34E,#94AF63,#FFFFFF,#6D8B42,#94AF63,#FFFFFF,#FFB10A,#DFA044

@ehoppmann
ehoppmann / hpd.py
Created June 4, 2019 18:28
Calculate highest posterior density (HPD) of array for given alpha. From Bayesian Analysis with Python: https://github.com/aloctavodia/BAP/blob/master/first_edition/code/Chp1/hpd.py
from __future__ import division
import numpy as np
import scipy.stats.kde as kde
def hpd_grid(sample, alpha=0.05, roundto=2):
"""Calculate highest posterior density (HPD) of array for given alpha.
The HPD is the minimum width Bayesian credible interval (BCI).
The function works for multimodal distributions, returning more than one mode
Parameters
@ehoppmann
ehoppmann / scalebars.py
Created May 28, 2019 18:37 — forked from dmeliza/scalebars.py
matplotlib: add scale bars to axes
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid1
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
from matplotlib.offsetbox import AnchoredOffsetbox
class AnchoredScaleBar(AnchoredOffsetbox):
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None,
**kwargs):
@ehoppmann
ehoppmann / awslogs_to_lambda_cost.py
Created August 29, 2018 16:35
Compute lambda cost from logs downloaded using awslogs
COST_GB_SEC = 0.00001667
cost = 0
with open('logs.log', 'r') as f:
logs = f.readlines()
billing = [i.split('\t') for i in logs if '\tBilled Duration:' in i]
for i in billing:
gb = float(i[3].lstrip('Memory Size: ').rstrip(' MB')) / 1024
sec = float(i[2].lstrip('Billed Duration: ').rstrip(' ms ')) / 1000
@ehoppmann
ehoppmann / ordered_set.py
Last active August 13, 2018 14:51
Returns a list containing only unique elements from original list, with an optional key function
from typing import Iterable, Callable, List
def ordered_set(iterable: Iterable, key: Callable=lambda x: x) -> List:
"""
Returns a new list containing all unique items from the iterable. A custom key function can
be specified to customize the uniqueness constraint, for example to return the first unique
element from the input list based on the second item in each element, one could pass
`lambda x: x[1]`.
"""
out_list = []
@ehoppmann
ehoppmann / pandas heatmaps
Created August 22, 2017 18:55 — forked from s-boardman/pandas heatmaps
Heatmap functions for Pandas dataframes.
"""Plots a Pandas dataframe as a heatmap"""
import matplotlib as mpl
import matplotlib.pyplot as plt
def heatmap(df,
edgecolors='w',
cmap=mpl.cm.RdBu,
log=False,vmin=0,vmax=500):
width = len(df.columns)/4
height = len(df.index)/4