Skip to content

Instantly share code, notes, and snippets.

@djangosporti
djangosporti / git-tag-delete-local-and-remote.sh
Created November 1, 2018 00:56 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName

PSQL CLI Client

Psql is a fully-fledged CLI client for Postgres, but most people are unaware of its many advanced features.

~/.psqlrc can be edited to persist any behavior or configuration settings you want between psql sessions. It behaves just like ~/.bashrc or ~/.vimrc, sourced at psql launch. See More out of psql for some interesting configurations.

If you have a long query to write and rewrite, you can use \e to edit your query in an editor.

Use \watch at the end of a query in order to automatically re-run the query every few seconds - great for monitoring while making changes elsewhere in your application architecture.

@djangosporti
djangosporti / git tutorials.md
Created October 30, 2017 01:58 — forked from jaseemabid/git tutorials.md
Awesome git tutorials I am finding here and there
@djangosporti
djangosporti / 01_models.py
Created October 17, 2017 21:34 — forked from dimi-tree/01_models.py
Django REST Framework: understaning ModelSerializer
from django.db import models
class Member(models.Model):
# RE: null vs blank
#
# NULL https://docs.djangoproject.com/en/1.10/ref/models/fields/#null
# Avoid using null on string-based fields such as CharField and TextField because
# empty string values will always be stored as empty strings, not as NULL.
#
@djangosporti
djangosporti / README.md
Created July 5, 2017 03:57 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@djangosporti
djangosporti / fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Created June 19, 2017 00:57 — forked from tejastank/fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display.
How to Fix it:
1. Remove wkhtmltopdf and related package
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
2. Install requirement package for compiling
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@djangosporti
djangosporti / settings.py
Created February 22, 2017 02:18 — 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',