Skip to content

Instantly share code, notes, and snippets.

View ZeroCoolHacker's full-sized avatar
🎖️
Code Lover

Zero Cool ZeroCoolHacker

🎖️
Code Lover
View GitHub Profile
@ZeroCoolHacker
ZeroCoolHacker / index.html
Last active December 5, 2017 20:46
Tribute Page
<div class="container">
<div class="jumbotron">
<h1 class="text-primary text-center">Leader Imran Khan</h1>
<h2 class="text-center"><em>Who saved 193 million people</em></h2>
<div class="thumbnail">
<img src="http://p.imgci.com/db/PICTURES/CMS/246700/246783.jpg" alt="Imran Khan shaking hands with the Queen.">
<div class="caption">
<p class="text-center">Imran Khan,the one shaking hands with queen, is introduced to the Queen by Intikhab Alam, Lord's, 1971</p>
</div>
</div><!-- End of thumbnail -->
Verifying my Blockstack ID is secured with the address 1HR3zk5qa8evQaGzPcHEJnxnZAErBvn5bn https://explorer.blockstack.org/address/1HR3zk5qa8evQaGzPcHEJnxnZAErBvn5bn
@ZeroCoolHacker
ZeroCoolHacker / adding-to-user-admin-form.py
Created September 27, 2018 17:40 — forked from riklomas/adding-to-user-admin-form.py
How to add a field to the Django Admin Add User form using UserCreationForm. Add this to a admin.py and alter to whatever fields you'd like
# How to add a field to the Django Admin Add User form
# using UserCreationForm. Add this to a admin.py and alter
# to whatever fields you'd like
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
@ZeroCoolHacker
ZeroCoolHacker / meta-tags.md
Created May 21, 2019 12:40 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@ZeroCoolHacker
ZeroCoolHacker / foo.py
Created October 23, 2020 19:54 — forked from Grokzen/Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
"""
### pizza/models.py ###
@ZeroCoolHacker
ZeroCoolHacker / wkhtmltopdf.sh
Created January 7, 2021 08:11 — forked from faniska/wkhtmltopdf.sh
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@ZeroCoolHacker
ZeroCoolHacker / docker-compose.yml
Created January 7, 2021 11:02 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@ZeroCoolHacker
ZeroCoolHacker / backup-and-restore-postgres-docker
Last active January 20, 2024 19:44
Backup and restore or clone a postgres database using docker
# Backup Postgres Database
```docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql```
# Restore Postgres Database
```cat your_dump.sql | docker exec -i your-db-container psql -U postgres```
# run python x.py > file.py to get the new dict
for x in Currency:
symbol = CURRENCY_SYMBOLS_MAP.get(x.value, None)
if symbol:
currency = CurrencyHelper._CURRENCY_DATA.get(x)
CurrencyHelper._CURRENCY_DATA[x]['symbol'] = symbol
CurrencyHelper._CURRENCY_DATA[x]['thousand_separator'] = ','
CurrencyHelper._CURRENCY_DATA[x]['symbol_placement'] = 'before'
with open("new.py", "w") as f: