Skip to content

Instantly share code, notes, and snippets.

View install-oh-my-zsh-on-ubuntu
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH
View python_locale.md
import locale
old_locale = locale.getlocale()
old_locale

('en_US', 'UTF-8')

@easydevmixin
easydevmixin / fingerprints.sh
Created Oct 19, 2016
Script showing fingerprints for public key files (RSA and DSA)
View fingerprints.sh
for file in *.pub
do
echo $file
ssh-keygen -l -E md5 -f $file
echo
done
View hashutils.py
import hashlib
from io import BytesIO
BLOCKSIZE = 65536
def digest_file(filename, hasher_alg=hashlib.sha1()):
hasher = hasher_alg
with open(filename, 'rb') as afile:
buf = afile.read(BLOCKSIZE)
@easydevmixin
easydevmixin / add_attachment.html
Created Jul 17, 2015
Easily dealing with multiple files in Django
View add_attachment.html
<!DOCTYPE html>
{% load i18n staticfiles %}
<html>
<!-- file: add_attachment.html -->
<head lang="en">
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
@easydevmixin
easydevmixin / cacheutils.py
Last active Aug 29, 2015
Creating a Django 1.8 admin command
View cacheutils.py
def clear_whole_cache():
print("Hey, the whole cache is cleared!")
def clear_partial_cache():
print("Hey, partial cache is cleared!")
@easydevmixin
easydevmixin / .gitignore
Created Jun 22, 2015
Django Project Layout
View .gitignore
# Python compiled classes
__pycache__/
*.pyc
# SQLite databases
*.sqlite
*.sqlite3
*.db
# Project specific