Skip to content

Instantly share code, notes, and snippets.

View ranelpadon's full-sized avatar

ranelpadon

View GitHub Profile
@ranelpadon
ranelpadon / settings.json
Created February 23, 2021 05:04
VS Code Settings
{
"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,
@ranelpadon
ranelpadon / karabiner.json
Last active February 23, 2021 05:07
Colemak DHk - Karabiner Elements - Config File
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@ranelpadon
ranelpadon / migrations_syncer.py
Last active April 24, 2021 09:43
Django Migrations Syncer: Prevent "duplicate table/column" errors when running migrations due to a similarly named, previously run migration
# 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,
)
@ranelpadon
ranelpadon / .zshrc
Last active September 30, 2021 21:14
YouTube Downloader and Trimmer
# 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
@ranelpadon
ranelpadon / mouse_mover.py
Created September 22, 2022 09:09
Simple script to move the mouse cursor randomly and indefinitely. This will make your status stay "Online" in various apps.
"""
Requires `pip install pyautogui`.
"""
import pyautogui
import random
import time
# Get the screen boundaries.
@ranelpadon
ranelpadon / sync_migrations.py
Created July 6, 2022 20:07
Prevent "duplicate table/column" errors when running migrations due to a similarly named, previously ran migration
"""
manage.py sync_migrations
"""
import re
from django.core.management.base import BaseCommand
from django.db import (
DEFAULT_DB_ALIAS,
connections,
)