Skip to content

Instantly share code, notes, and snippets.

@easydevmixin
easydevmixin / install-oh-my-zsh-on-ubuntu
Created February 14, 2018 19:19 — forked from richardtape/install-oh-my-zsh-on-ubuntu
Install Oh My ZSH on Ubuntu 14.04
# 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
import locale
old_locale = locale.getlocale()
old_locale

('en_US', 'UTF-8')

@easydevmixin
easydevmixin / fingerprints.sh
Created October 19, 2016 18:48
Script showing fingerprints for public key files (RSA and DSA)
for file in *.pub
do
echo $file
ssh-keygen -l -E md5 -f $file
echo
done
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 July 17, 2015 06:02
Easily dealing with multiple files in Django
<!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 August 29, 2015 14:24
Creating a Django 1.8 admin command
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 June 22, 2015 10:52
Django Project Layout
# Python compiled classes
__pycache__/
*.pyc
# SQLite databases
*.sqlite
*.sqlite3
*.db
# Project specific