sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- Download zsh-autosuggestions by
### Remote db state must be at the same exact state of the local DB | |
### Steps will be done on two stages: | |
### 1. local db stage | |
1. make sure you are in your django project path, and run `find . -path "*migrations*" -name "*.py" -not -path "*__init__*" -exec rm {} \;` | |
2. pip install --upgrade --force-reinstall Django, because this path usually removes django's own migrations. | |
3. Remove django migrations history table from your local database. | |
from django.db import connections | |
with connections["default"].cursor() as cursor: |
""" | |
Django Management Command to print a "Magic Link" for one-click login | |
by Jeff Triplett <jefftriplett> / https://twitter.com/webology | |
https://gist.github.com/jefftriplett/e87b36d750f94e48080a2be46e71dbe1 | |
Relies on: https://github.com/aaugustin/django-sesame | |
$ pip install django-click | |
$ pip install django-sesame[ua] |
import RPi.GPIO as GPIO | |
import time | |
TRIGGER = 18 | |
ECHO = 24 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(TRIGGER, GPIO.OUT) | |
GPIO.setup(ECHO, GPIO.IN) |
# Change to the project directory | |
cd $FORGE_SITE_PATH | |
# Turn on maintenance mode | |
php artisan down || true | |
# Pull the latest changes from the git repository | |
# git reset --hard | |
# git clean -df | |
git pull origin $FORGE_SITE_BRANCH |
# file: /etc/nginx/sites-available/example.com | |
# nginx configuration for example.com | |
server { | |
listen 80; | |
server_name example.com; | |
access_log /var/www/example.com/logs/access.log; | |
error_log /var/www/example.com/logs/error.log; | |
# pass root to django |
#!/bin/sh | |
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <[email protected]> | |
# | |
# SPDX-License-Identifier: MIT | |
arch=$(dpkg --print-architecture) | |
echo "Detected architecture: $arch" | |
case "$arch" in |
from django.utils.http import urlencode | |
def reverse_querystring(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None): | |
'''Custom reverse to handle query strings. | |
Usage: | |
reverse('app.views.my_view', kwargs={'pk': 123}, query_kwargs={'search': 'Bob'}) | |
''' | |
base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app) | |
if query_kwargs: | |
return '{}?{}'.format(base_url, urlencode(query_kwargs)) |