Skip to content

Instantly share code, notes, and snippets.

View souravjamwal77's full-sized avatar
💭
Sleeping

Sourav Kumar souravjamwal77

💭
Sleeping
View GitHub Profile
@thuwarakeshm
thuwarakeshm / check_password.py
Last active February 15, 2024 17:18
Streamlit with Django
def check_password():
"""Returns `True` if the user had a correct password."""
def password_entered():
"""Checks whether a password entered by the user is correct."""
user = authenticate(
username=st.session_state['username'],
password=st.session_state['password']
)
@egor83
egor83 / django_apache_mod_wsgi_deployment
Last active May 13, 2022 12:19
Deploying Django on Apache server with mod_wsgi
Deploying Django on Apache server with mod_wsgi
Per https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/modwsgi/
https://modwsgi.readthedocs.io/en/develop/installation.html
Some things are not immediately obvious, so I'm writing down the detailed list of steps that worked for me.
I started with bare VPS, using Ubuntu 18.04.4. Python 3 (3.6.9) was available out of the box, but not Python 2.
Used the latest mod_wsgi version available (mod_wsgi-4.7.1)
@valferon
valferon / postgres_manager.py
Created March 29, 2018 02:35
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@ejmr
ejmr / git-branch-show-description.sh
Last active May 29, 2022 07:41
Show the Description for the Current Branch
#!/bin/bash
#
# You can use `git branch --edit-description` to write a description
# for a branch, but Git provides no simple command to display that
# description. The "easiest" way to see it is via `git config --get
# branch.BRANCH_NAME.description`.
#
# This script automates that process and is meant to be used as
# a Git alias to provide a shorter command for showing the
# description of the current branch.
@evandrix
evandrix / pep20_by_example.py
Created March 13, 2012 18:45
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com