Skip to content

Instantly share code, notes, and snippets.

@ngenator
ngenator / github.user.js
Last active August 13, 2019 15:49
Removes width constraints on github elements
// ==UserScript==
// @name Wide Github
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Removes width constraints on github elements
// @author Ngenator
// @updateURL https://gist.github.com/ngenator/7b68fff111d1975a71e1403f4fb12024/raw/github.user.js
// @include https://github.com/*
// @include https://gist.github.com/*
// @grant GM_addStyle
@ngenator
ngenator / AWS Health Event Types.md
Last active September 11, 2023 01:30
AWS Health Event Types

AWS Health Events

Analytics

A dump of the AWS Health event types taken from their DescribeEventTypes API which requires an active support plan to use.

# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
def bubble_sort(to_sort):
for i in range(len(to_sort) - 1):
for j in range(len(to_sort) - 1):
if to_sort[j+1] < to_sort[j]:
temp = to_sort[j]
to_sort[j] = to_sort[j+1]
to_sort[j+1] = temp
return to_sort
def selection_sort(to_sort):
for i in range(len(to_sort) - 1):
minimum = i
for j in range(len(to_sort) - 1):
if to_sort[j] < to_sort[minimum]:
minimum = j
temp = to_sort[i]
to_sort[i] = to_sort[minimum]
to_sort[minimum] = temp
return to_sort
@ngenator
ngenator / bellmanford.py
Created August 7, 2013 21:11
Bellman-Ford algorithm in python
def bellman_ford(graph, source):
# Step 1: Prepare the distance and predecessor for each node
distance, predecessor = dict(), dict()
for node in graph:
distance[node], predecessor[node] = float('inf'), None
distance[source] = 0
# Step 2: Relax the edges
for _ in range(len(graph) - 1):
for node in graph: