Skip to content

Instantly share code, notes, and snippets.

View nanorepublica's full-sized avatar
🔒
Encryption is hard...

Andrew Miller nanorepublica

🔒
Encryption is hard...
View GitHub Profile
@cb109
cb109 / forms.py
Last active September 25, 2024 08:02
Reusing the Django Admin AutocompleteSelect Widget in a custom Template
from typing import Iterable
from typing import Optional
from django.contrib import admin
from django.contrib.admin.widgets import AutocompleteSelect
from django.forms import ModelChoiceField
from myproject.myapp.models import MyCustomModel
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active April 24, 2025 02:56
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@porterjamesj
porterjamesj / hello_mesos.py
Last active March 6, 2018 20:43
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)
@wetzler
wetzler / gist:4f70beaed4010173810f
Created July 15, 2014 20:13
Recipe for Keen IO line chart with cumulative data (V2 Of Keen JS library)
-------------------------------
Line Chart with Cumulative Data
-------------------------------
This is an example for how you can create a line chart with data that is shown cumulatively.
.. note::
This example is current for our JS SDK v2.1.2 only. It does not apply to v3+
.. code-block:: javascript
@wetzler
wetzler / gist:8986385
Created February 13, 2014 23:44
Pseudocode for making a cumulative line chart with Keen IO series data. Use this to make a running total of users, for example. The gist assumes that the timeframe being queried includes all of the data.
Keen.onChartsReady(function() {
var series = new Keen.Series("registrations", {
analysisType: "count",
timeframe: "last_30_weeks",
interval: "weekly"
});
series.getResponse(function(response){
keenData = response.result;

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@vsajip
vsajip / ansistrm.py
Created December 29, 2010 11:14
Python logging: colourising terminal output
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {