Skip to content

Instantly share code, notes, and snippets.

View kayode-adechinan's full-sized avatar

Kayode Adechinan kayode-adechinan

  • Dakar, Senegal
View GitHub Profile
@kayode-adechinan
kayode-adechinan / clone-mysql-db.sh
Created November 3, 2018 16:41 — forked from christopher-hopper/clone-mysql-db.sh
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@kayode-adechinan
kayode-adechinan / gist:90d5f68ed2f2a994c3955bbf4ec374a4
Created November 6, 2018 11:56 — forked from guillaumepiot/gist:5583149
DJANGO - Admin custom list filter
class CategoryListFilter(SimpleListFilter):
# USAGE
# In your admin class, pass trhe filter class as tuple for the list_filter attribute:
#
# list_filter = (CategoryListFilter,)
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
@kayode-adechinan
kayode-adechinan / templatetags.py
Created November 19, 2018 17:34 — forked from benbacardi/templatetags.py
Django query_transform templatetag
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def query_transform(context, **kwargs):
'''
Returns the URL-encoded querystring for the current page,
updating the params with the key/value pairs passed to the tag.
@kayode-adechinan
kayode-adechinan / settings.py
Created November 24, 2018 18:35 — forked from palewire/settings.py
My current default Django LOGGING configuration
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
},
'null': {
'level':'DEBUG',

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
pacman -S mariadb
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql //注意这个datadir,很重要,按照默认操作
systemctl enable mysqld
systemctl start mysqld
mysql_secure_installation

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
#!/bin/bash
#######################################################################
#
# Solus OS system setup
#
#######################################################################
# Go into a temp work directory
mkdir ~/tmp-installer
1. Define this in your setting.py
DEBUG = False
STATIC_ROOT = '/opt/lampp/htdocs/static/'
2. Run
python manage.py collectstatic
3. Create a proxy -> sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
1. Allow the usage of custom virtual hosts. Open the httpd.conf
sudo gedit /opt/lampp/etc/httpd.conf
2. Uncomment the line bellow
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
3. Create a custom domain in the hosts file of your system