Skip to content

Instantly share code, notes, and snippets.

@thruflo
thruflo / test_geography.py
Created November 28, 2011 22:59
Example using PostGIS Geography Type with GeoAlchemy.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import code
import logging
from datetime import datetime
from sqlalchemy import create_engine, event
from sqlalchemy import Column, Float, Integer, MetaData, UnicodeText
@mattwigway
mattwigway / gist:3492444
Created August 27, 2012 21:32
beans for nyc
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
<property name="url" value="http://gtfs.s3.amazonaws.com/pvta_20120820_0735.zip" />
<property name="defaultAgencyId" value="pvta" />
</bean>
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
<property name="url" value="http://gtfs.s3.amazonaws.com/port-authority-of-new-york-new-jersey_20110512_0300.zip" />
<property name="defaultAgencyId" value="port-authority-of-new-york-new-jersey" />
</bean>
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
<property name="url" value="http://gtfs.s3.amazonaws.com/lanta_20120701_0310.zip" />
@mattwigway
mattwigway / gist:3694190
Created September 10, 2012 21:53
NYC WV graph builder
<!-- total: 79 feeds -->
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
<property name="url" value="http://gtfs.s3.amazonaws.com/pvta_20120820_0735.zip" />
<property name="defaultAgencyId" value="pvta" />
</bean>
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
<property name="url" value="http://gtfs.s3.amazonaws.com/port-authority-of-new-york-new-jersey_20110512_0300.zip" />
<property name="defaultAgencyId" value="port-authority-of-new-york-new-jersey" />
</bean>
<bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
@willglynn
willglynn / indexes_for_hstore_column.sql
Created September 21, 2012 01:39
Automatic index generation for all hstore keys
CREATE OR REPLACE FUNCTION indexes_for_hstore_column(full_table_name varchar, hstore_column varchar) RETURNS SETOF varchar AS $$
DECLARE
table_oid oid;
table_name varchar;
schema_name varchar;
key varchar;
index_name varchar;
index_exists integer;
unique_keys_query varchar;
create_index_statement varchar;
@flibbertigibbet
flibbertigibbet / FeedFetcher.py
Last active June 14, 2017 02:25
Checks for new GTFS feeds, then downloads and validates them. Fetches feeds for SEPTA, NYC MTA, NJ TRANSIT, CTTRANSIT, Delaware First State, NJ/NY PATH, and PATCO. Dependencies: Python requests, BeautifulSoup, git, and Google's transit feed validator. NJ TRANSIT developer login credentials required to download from that agency. Cannot check for …
#!/usr/bin/python
import requests, os, pickle, datetime, zipfile, subprocess, csv
from bs4 import BeautifulSoup
class FeedFetcher():
def __init__(self, ddir=os.getcwd(), get_nj=True, nj_username='', nj_pass=''):
self.ddir = ddir
self.get_nj = get_nj # whether to fetch from NJ TRANSIT or not
self.tc = {} # time checks for GTFS fetches
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2025 16:56
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s

Simple Security Guidelines

Using an iDevice? (Best option)

  • Use an iPod or an iPad without a SIM card
  • Use an iPhone
  • Do not jailbreak
  • Always upgrade to new iOS versions
  • Use Brave browser

Need Secure chat?

@berkant
berkant / cloud-init.cfg
Last active January 18, 2025 07:43
Cloud-init config to set up my Ubuntu dev machine.
## template: jinja
#cloud-config
{% if v1.distro_release == 'focal' %}
users:
- name: berkant
shell: /usr/bin/bash
ssh_import_id: gh:berkant
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
@probonopd
probonopd / Wayland.md
Last active May 22, 2025 21:43
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.


As 2024 is winding down:

@triangletodd
triangletodd / README.md
Last active May 6, 2025 11:38
k3s in LXC on Proxmox

On the host

Ensure these modules are loaded

cat /proc/sys/net/bridge/bridge-nf-call-iptables

Disable swap

sysctl vm.swappiness=0
swapoff -a