Skip to content

Instantly share code, notes, and snippets.

View unixnut's full-sized avatar

Alastair Irvine unixnut

  • Warpspace IT
  • Perth, WA, Australia
View GitHub Profile
def donut_chart(value):
if value >= 80:
color = [0.4392,0.6784,0.2784]
if (value < 80) and (value >= 60):
color = [0.9569,0.6941,0.5137]
if value < 60:
color = [1.0000,0.4118,0.4118]
my_circle=plt.Circle( (0,0), 0.8, color=[0.4902,0.8000,1.0000])
def bar_chart(credit, debit, balance):
x = [x[0:6] for (x,y) in balance]
y1 = [y for (x,y) in credit]
y2 = [y for (x,y) in debit]
y3 = [y for (x,y) in balance]
n = len(x)
index = np.arange(n)
@AnthonyBriggs
AnthonyBriggs / project_names.py
Last active June 15, 2023 00:42
Project codename generator
#!/usr/bin/env python3
"""
Project naming scheme (roughly; funny trumps the rules):
<weird/funny animal> + <word which should be rude but isn't>
Useful if management / fellow developers are taking themselves too seriously."""
import random
thing = """PROJECT OPERATION PLAN PROGRAM DIRECTIVE ASSIGNMENT OBJECTIVE INCIDENT SCENARIO""".split()
@miguelgrinberg
miguelgrinberg / .vimrc
Last active April 4, 2024 19:06
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@mortie
mortie / sercom.py
Last active March 25, 2020 05:05
Better serial console.
#!/usr/bin/env python3
import serial
import sys
import os
import threading
import traceback
if len(sys.argv) not in (2, 3):
print(f"Usage: {sys.argv[0]} <path> [baud]")
tk = Person('TK', 'tk@mail.com')
print(tk.email()) # => tk@mail.com
# tk._email = 'new_tk@mail.com' -- treat as a non-public part of the class API
print(tk.email()) # => tk@mail.com
tk.update_email('new_tk@mail.com')
print(tk.email()) # => new_tk@mail.com
class Person:
def __init__(self, first_name, email):
self.first_name = first_name
self._email = email
def update_email(self, new_email):
self._email = new_email
def email(self):
return self._email
@miguelgrinberg
miguelgrinberg / app.py
Created July 13, 2017 11:46
datetimepicker-example
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_wtf import Form
from wtforms.fields import DateField
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
Bootstrap(app)
@stared
stared / aspie_traits.md
Last active January 29, 2022 08:16
Interpersonal Traits of Aspies Placed in Context

Interpersonal Traits of Aspies Placed in Context

a chapter from A Mind-Body Look at the Concept of Asperger's Syndrome (pdf) by Michael Samsel, LMHC

A Hacker News discussion (2021) on this list

Uncommunicative Eye Contact

In humans, eye contact is the center of the attachment system. In Asperger's Syndrome there is either an avoidance of eye contact (most common) or an unvarying, relative unblinking, staring, constant eye contact (less common). Avoidant eye contact gives an impression of 'having something to hide', and also eliminates a big channel of communication and trust. Staring eye contact, because of its unchanging nature, is also uncommunicative, and is generally experienced as disturbing on the receiving end.

import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())