Skip to content

Instantly share code, notes, and snippets.

View theArjun's full-sized avatar

Arjun Adhikari theArjun

View GitHub Profile
@iamawmrit
iamawmrit / rewrite.sh
Last active May 16, 2023 10:01
Rewrite git history
git filter-branch --env-filter '
if [ "$GIT_AUTHOR_EMAIL" = "email@email.com" ]; then
GIT_AUTHOR_NAME="username"
GIT_AUTHOR_EMAIL="email2@email2.com"
fi
if [ "$GIT_COMMITTER_EMAIL" = "email@email.com" ]; then
GIT_COMMITTER_NAME="username"
GIT_COMMITTER_EMAIL="email2@email2.com"
fi
' --tag-name-filter cat -- --branches --tags
@theArjun
theArjun / Flake8 Configuration
Last active August 29, 2022 06:07
ISORT, Yapf and Flake8 Configuration
Name: flake8
-- Files to Watch
File Type: Python
Scope: Project Files
-- Tools to Run on Changes
Program: $PyInterpreterDirectory$\python
Arguments: -m flake8 $FilePath$ --config=setup.cfg --ignore=E133 --format='%(path)s:%(row)d,%(col)d:%(code)s:%(text)s:https://lintlyci.github.io/Flake8Rules/rules/%(code)s.html'
Output paths to refresh: $FilePath$
@umanghome
umanghome / publish.yml
Last active February 7, 2026 21:49
GitHub Action: Generate a build and push to another branch
# .github/workflows/publish.yml
name: Generate a build and push to another branch
on:
push:
branches:
- master # Remove this line if your primary branch is "main"
- main # Remove this line if your primary branch is "master"
jobs:
@gamorales
gamorales / ci.yml
Last active January 1, 2022 04:05
Continous Integration github actions
name: Continous Integration
on:
pull_request:
branches:
- development
jobs:
build:
@dchuvardynskyi
dchuvardynskyi / pytest.ini
Created November 20, 2019 10:33
Pytest Django pytest.ini file example
[pytest]
DJANGO_SETTINGS_MODULE = yourproject.settings
python_files = tests.py test_*.py *_tests.py
addopts = -p no:warnings --strict-markers --no-migrations --reuse-db
norecursedirs = venv old_tests
markers =
custom_mark: some information of your mark
slow: another one slow tes
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
@hakib
hakib / admin.py
Last active January 22, 2024 15:18
How to Turn Django Admin Into a Lightweight Dashboard
# https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard
from django.contrib import admin
from django.db.models import Count, Sum, Min, Max, DateTimeField
from django.db.models.functions import Trunc
from . import models
def get_next_in_date_hierarchy(request, date_hierarchy):
@EtsuNDmA
EtsuNDmA / django_jupyter.md
Last active February 11, 2025 17:12
Two ways to integrate Django with Jupyter (JupyterLab)

⚠️ This gist was the first time written in 2018. It was tested with django==2.2.x. It's likely to be relevant for the newer versions of django and jupyter, but I did't check that.

2023-03-15: checked it for python == 3.11, django == 4.1.7, jupyterlab = 3.6.1, django-extensions == 3.2.1, jupyter-server <= 2.0.0

Django_jupyter

Using Django project in Jupyter or JupyterLab

Method 1 (using shell_plus)

@Amitind
Amitind / YouTubNow.com
Last active February 8, 2025 15:27
Download YouTube Video Using Bookmarklet
javascript: var regeX = /^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&\?]*).*/,
getYTURL = location.href,
video_id, match = getYTURL.match(regeX);
if (match && 11 == match[2].length) {
video_id = match[2];
var url = "https://www.youtubnow.com/watch/?v=" + escape(video_id);
(w = open(url, "w", "location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=800,modal=yes,dependent=yes")) ? setTimeout("w.focus()", 1E3): location = url
} else alert(" That's Not a Valid YouTube URL, \n Need URL like this \n http://youtube.com/watch?v=KuUYePG6ygQ ");
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" set easymotion
set NERDTree
" Copy to system clipboard as well