Skip to content

Instantly share code, notes, and snippets.

Avatar

Ashley Felton ropable

View GitHub Profile
@Tras2
Tras2 / cloudflare-ddns-update.sh
Last active Dec 4, 2021
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
View cloudflare-ddns-update.sh
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@Prototype-X
Prototype-X / upgrade-postgres-9.5-to-9.6.md
Last active Jan 14, 2021 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04
View upgrade-postgres-9.5-to-9.6.md

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main

Set db path for pg_upgradecluster:

@danni
danni / fields.py
Created Mar 8, 2016
Multi Choice Django Array Field
View fields.py
from django import forms
from django.contrib.postgres.fields import ArrayField
class ChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django 1.9's postgres ArrayField
and a MultipleChoiceField for its formfield.
@miraculixx
miraculixx / cors.py
Last active Jan 12, 2019
To enable CORS support in django-tastypie, use the following code snipet. Then create your tastypie resources as a subclass of BaseCorsResource.Basic code courtesy Daniel Conzalez of http://codeispoetry.me/index.php/make-your-django-tastypie-api-cross-domain/.I added documentation and the post_list method.
View cors.py
'''
Add CORS headers for tastypie APIs
Usage:
class MyModelResource(CORSModelResource):
...
class MyResource(CORSResource):
...
@willurd
willurd / web-servers.md
Last active Dec 4, 2021
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@wpscholar
wpscholar / jquery.external-links-new-window.js
Last active Aug 15, 2020
Open all external links in a new window
View jquery.external-links-new-window.js