Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
project_name=$1
python_version=$2
echo " --- Install/configure pyenv ---"
pyenv_dir="$HOME/.pyenv"
pyenv_cmd="$pyenv_dir/bin/pyenv" # to avoid modifying $PATH in this script
current_dir="$PWD"
@oogles
oogles / tests.py
Created July 8, 2019 00:37
Django test for detecting named URL patterns that would result in ambiguous reverse URL lookups by name and parameters. #django #python
from django.test import SimpleTestCase
from django.urls import get_resolver
def walk_url_names(patterns, namespace=None):
"""
Generator yielding the URL names (including namespaces and named capture
groups) of all URLs in the given sequence of URL patterns. Can be used to
detect duplicates.
@oogles
oogles / login.sh
Last active January 3, 2019 22:37
Non-interactive login to Sencha NPM registry
# Use this script to automate the process of logging in to the Sencha private
# NPM repository, as "npm login" does not support a non-interactive mode.
# Adapted from: https://stackoverflow.com/a/35831310/405174
sencha_username='' # set appropriately
sencha_password='' # set appropriately
sencha_registry='npm.sencha.com'
sencha_token=$(curl -s \
-H "Accept: application/json" \
@oogles
oogles / dev.cmd
Last active March 17, 2025 04:18
Script that opens a Windows command prompt, requesting Administrator privileges from UAC. Designed for working with Vagrant/VirtualBox on Windows, where the "vagrant up" command needs Administrator privileges if symlinks need to be created in the synced folder.
@echo off
:: =============================================================================
:: When using Vagrant with VirtualBox under Windows, with VirtualBox shared
:: folders, creating symlinks in the synced folder requires "vagrant up" be run
:: with Administrator privileges.
:: dev.cmd is a script designed to open a command prompt with Administrator
:: privileges, ready for running Vagrant commands.
:: It accepts the full path to a Vagrant project directory and does the following:
:: 1. Uses UAC to request Administrator privileges.