Skip to content

Instantly share code, notes, and snippets.

View BdVade's full-sized avatar

Victor Aderibigbe BdVade

  • Nigeria
View GitHub Profile
@randallreedjr
randallreedjr / heroku-remote.md
Last active February 7, 2025 09:12
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@valtron
valtron / capture_queries.py
Created February 25, 2014 18:56
Context manager for collecting queries executed in a Django environment.
class CaptureQueries(object):
"""
Context manager that captures queries executed by the specified connection.
Mostly copied from django.test.utils.CaptureQueriesContext.
"""
def __init__(self, connection = None):
if connection is None:
from django import db
connection = db.connection
@MorganBorman
MorganBorman / main.py
Created December 9, 2012 04:33
A short example of how to use vertex array objects in PyOpenGL
import OpenGL.GL as GL
import OpenGL.GL.shaders
import ctypes
import pygame
import numpy
vertex_shader = """
#version 330
in vec4 position;
@voldmar
voldmar / signals.py
Last active April 11, 2025 11:51
Show all signals receivers in Django project (fixed for Django 4 by @MahrezBH)
# coding:utf-8
import gc
import inspect
import weakref
from django.core.management.base import BaseCommand, CommandError
from django.dispatch import Signal
REF_TYPES = (weakref.ReferenceType,)