Skip to content

Instantly share code, notes, and snippets.

View theskumar's full-sized avatar

Saurabh Kumar theskumar

View GitHub Profile
@mdesantis
mdesantis / upgrade-postgres-9.6-to-10.md
Last active October 11, 2021 08:11 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.6 to 10 on Ubuntu 16.04

TL;DR

Install Postgres 10, and then:

sudo pg_dropcluster 10 main --stop
sudo pg_upgradecluster 9.6 main
sudo pg_dropcluster 9.6 main
"""
Logical deletion for Django models. Uses is_void flag
to hide discarded items from queries. Overrides delete
methods to set flag and soft-delete instead of removing
rows from the database.
"""
from django.apps import apps
from django.contrib.admin.utils import NestedObjects
from django.db import models
from django.db.models import signals
@Chronial
Chronial / whitenoise_compressor.py
Last active June 5, 2016 10:41
Whitenoise support for django compressor
from django.conf import settings
from whitenoise.django import DjangoWhiteNoise
class DjangoCompressWhiteNoise(DjangoWhiteNoise):
def __call__(self, environ, start_response):
# Handle files generated on the fly by django-compressor
url = environ['PATH_INFO']
if url.startswith(self.static_prefix) and url not in self.files:
if self.is_compressed_file(url):
@zachrose
zachrose / reserved-words.txt
Created November 28, 2015 05:46
URL paths to reserve in a web app
about
admin
blog
calendar
contact
copyright
dashboard
email
errors
events
@jshaw
jshaw / byobuCommands
Last active May 26, 2024 17:26
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@nanobox-io
nanobox-io / gist:1756086
Last active September 30, 2015 08:58
Deploy Hook Available Executables
awk
bunzip2
bzcat
bzip2
cat
chown
cp
curl
cut
date
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'