Skip to content

Instantly share code, notes, and snippets.

View elena's full-sized avatar

Elena Williams elena

View GitHub Profile
sudo apt update
sudo apt install -y mate-terminal emacs git git-cola gitg python3-pip python3-dev vlc gimp blender tree baobab virtualbox
sudo pip3 install --upgrade pip
sudo pip3 install virtualenv virtualenvwrapper thefuck pyflakes jedi flake8 importmagic autopep8 black isort bandit ruff
git config --global user.email "git@elena.net.au"
git config --global user.name "Elena Williams"
git config --global init.defaultBranch main
Command Mode (press Esc to enable)
F: find and replace
Ctrl-Shift-F: open the command palette
Ctrl-Shift-P: open the command palette
Enter: enter edit mode
P: open the command palette
Shift-Enter: run cell, select below
Ctrl-Enter: run selected cells
Alt-Enter: run cell and insert below
@elena
elena / people-models.py
Created August 13, 2020 05:36
Test Django GraphQL graphene_django logged in user authenticated unittest
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=100)
from py2neo import Graph, Node, Relationship
AFewGoodMen = Node("Movie", title="A Few Good Men", released=1992,
tagline="In the heart of the nation's capital, in a courthouse of the U.S. government, one man will stop at nothing to keep his honor, and one will stop at nothing to find the truth.")
ALeagueofTheirOwn = Node("Movie", title='A League of Their Own', released=1992,
tagline='Once in a lifetime you get a chance to do something different.')
AaronS = Node("Person", name='Aaron Sorkin', born=1961)
Al = Node("Person", name='Al Pacino', born=1940)
AnnabellaS = Node("Person", name='Annabella Sciorra', born=1960)
@elena
elena / README
Created July 3, 2018 10:36
py2neo date bug -- fortunately easy to replicate
versions:
Pipfile.lock
"py2neo": {
"hashes": [
"sha256:09805b0a2980607ed633689aceae26516f530795fef540ebcf26ab06faef3b38"
],
"index": "pypi",
"version": "==4.0.0"
},
@elena
elena / generate-django-unique-ref
Created June 15, 2017 08:19
Generate unique slug function and generate unique hex string function for Django
# -*- coding: utf-8 -*-
import binascii
import os
from django.core.exceptions import ObjectDoesNotExist
from django.utils.text import slugify
def generate_unique_slug(text, queryset, slug_field='slug', iteration=0):
slug = slugify(text)
@elena
elena / .git-commit-template.txt
Created June 9, 2017 01:19 — forked from adeekshith/.git-commit-template.txt
This commit message template that helps you write great commit messages and enforce it across your team.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
### Keybase proof
I hereby claim:
* I am elena on github.
* I am elena (https://keybase.io/elena) on keybase.
* I have a public key whose fingerprint is BFB6 7B0C EFE3 A9BC 47A8 554C 330E 54CA 48C0 3FDA
To claim this, I am signing this object:
@elena
elena / gist:7209238
Last active December 26, 2015 20:29
10 ways to make university IT assignments more relevant to industry.
"10 ways to make university IT assignments more relevant to industry."
1) Change the assignment several times while students are working on it.
2) Assign 5 new members to the team 2 days before the assignment is
due, claiming extra resources are needed. The students are told that
'mythical man month' does not apply in this case because of awesome
management skills.
3) Have the best programmer in the team designated 'programmer'. Then
@elena
elena / Basic MultiValueField MultiWidget
Created October 19, 2012 01:25
Super Basic Django MultiValueField / MutliWidget example
"""
An example of minimum requirements to make MultiValueField-MultiWidget for Django forms.
"""
import pickle
from django.http import HttpResponse
from django import forms
from django.template import Context, Template
from django.views.decorators.csrf import csrf_exempt