This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Requires `pip install pyautogui`. | |
""" | |
import pyautogui | |
import random | |
import time | |
# Get the screen boundaries. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
manage.py sync_migrations | |
""" | |
import re | |
from django.core.management.base import BaseCommand | |
from django.db import ( | |
DEFAULT_DB_ALIAS, | |
connections, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your `~/.bash_profile` or `~/.zshrc` file, | |
# so that running the Python script in the terminal is more convenient. | |
# Command: yvt URL START_TIME END_TIME | |
# Sample: yvt 'https://www.youtube.com/watch?v=RjxKVAOZCQY' 9:41 10:58 | |
yt_video_trimmer() { | |
python <PATH TO>/yt-video-trimmer.py $1 $2 $3 | |
} | |
alias yvt=yt_video_trimmer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use: | |
# Put this file into a convenient location. | |
# Then, pipe the script into the Django shell (which will auto-connect to the target db assuming the db credentials are correct): | |
# $ python <PATH TO>/manage.py shell < <PATH TO>/migrations_syncer.py | |
# After running the script, check the `django_migrations` table if there are indeed new rows for already run migrations. | |
from subprocess import ( | |
PIPE, | |
Popen, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"window.zoomLevel": -1, | |
"terminal.integrated.fontFamily": "MesloLGS NF", | |
"terminal.integrated.cursorBlinking": true, | |
"terminal.integrated.cursorStyle": "line", | |
"editor.fontFamily": "Monaco, Menlo, 'Courier New', monospace", | |
"code-runner.fileDirectoryAsCwd": true, | |
"terminal.integrated.cwd": ".", | |
"terminal.integrated.shell.osx": "/usr/local/bin/zsh", | |
"atomKeymap.promptV3Features": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# forms.py | |
class EventSessionFormSet(); | |
... | |
def save(self, commit=True): | |
sessions = [] | |
forms = self.forms | |
total_forms = len(forms) | |
for i, form in enumerate(forms): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# Restricted symbols taken from https://en.wikipedia.org/wiki/Filename | |
symbols = ('/', '\\', '?', '%', '*', ':', '|', '"', '<', '>',) | |
symbols_replacements = {symbol: '_' for symbol in symbols} | |
space_replacement = {' ': '-'} # Dash instead of underscore | |
replacements = {} | |
replacements.update(symbols_replacements) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Workflow (Genre is the Parent Field, Artist is the Dependent Field): | |
// 1. user interacts w/ Genre select list widget via JS script. | |
// 2. JS script fetches the new Artist list in views.py | |
// 3. JSON response will be used as the new values/options for the Artist select list widget. | |
(function($) { | |
$(function() { | |
// Artist's select option values will depend on | |
// the Genre's selected option. | |
var $genreSelectWidget = $('#id_genre'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$(function() { | |
// Artist's select option values will depend on | |
// the Genre's selected option. | |
var $genreSelectWidget = $('#id_genre'); | |
var $artistSelectWidget = $('#id_artist'); | |
var artistSelectWidgetInitial = $artistSelectWidget.val() | |
// Adjust Artists based on the selected Genre. | |
function adjustArtistOptions(preSelectedOption) { |
NewerOlder