Skip to content

Instantly share code, notes, and snippets.

View dmpayton's full-sized avatar
🦄
Doin' all the things.

Derek Payton dmpayton

🦄
Doin' all the things.
View GitHub Profile
@aykevl
aykevl / fire.py
Last active January 29, 2024 17:17
FastLED animations for MicroPython, see: https://forum.micropython.org/viewtopic.php?f=15&t=3749
import machine
import pixels
import array
import urandom
import time
# Source:
# https://github.com/FastLED/FastLED/blob/master/examples/Fire2012WithPalette/Fire2012WithPalette.ino
heatColors = array.array('L', [0x000000,
@show0k
show0k / install_circuit_maker_osx.sh
Created July 5, 2017 13:25
Run CircuitMaker on OSX thanks to wine and winetricks
# If Homebrew is not installed uncomment the next line
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Wine and WineTricks
brew install wine && brew install winetricks
# Download CircuitMaker
curl https://s3.amazonaws.com/altium-install/CircuitMaker/CircuitMakerSetup.exe -o ~/Downloads/CircuitMakerSetup.exe
@dglaude
dglaude / (NEW_VERSION_OF)random.py
Last active January 23, 2023 16:55
Blinkt! API for microPython (ESP8266)
f=open("random.py","w")
f.write('''import os
def getrandbits(k):
numbytes = (k + 7) // 8
x = int.from_bytes(os.urandom(numbytes), 'big')
return x >> (numbytes * 8 - k)
def bit_length(n):
res = n
# build with
# docker build -f Dockerfile.buildozer -t buildozer .
# use the produced image with
# docker run -v your_project_dir:/root/build buildozer
# at the end of the run, the build directory in your project should contain the apk
# you can use the /root/.buildozer/ volume to cache your distributions (first usage may be longer)
FROM ubuntu:latest
RUN dpkg --add-architecture i386 &&\
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@jacobian
jacobian / why open source django.md
Created July 24, 2013 17:49
Our arguments for open sourcing Django
  1. The code will get better. Linus' Law: "given enough eyeballs, all bugs are shallow": we'll be able to get community contributions and bug reports, and thus the code will grow better faster than we can grow it ourselves. Also, Joy's Law - "No matter who you are, most of the smartest people work for someone else": we'll get better code from people who don't work for us than from people who do.

  2. We'll write better code. Wall's 3rd great virtual of a programmer, Hubris: we'll write better code people we don't want other people to say bad things about us. We'll do better with the world watching than with just us.

  3. Increased ability to hire. We're a 19k circ newspaper in a town most people have never heard of. Open source will help put us on the map, make us a place people actually might be interested in working.

  4. When we do hire, we'll be able to hire pe

@roadsideseb
roadsideseb / edit.py
Created April 9, 2013 08:42
MultiFormView for handling multiple forms in a Django CBV with a little more ease...
"""
The following mixins and views are borrowed and adapted from the following
gist:
https://gist.github.com/michelts/1029336
"""
from functools import partial
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.edit import ProcessFormView, FormMixin
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

{% load handlebars i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
{% filter handlebars %}
<script type="text/x-handlebars">
{$ #view App.MenuView $}
@cyberdelia
cyberdelia / mixin.py
Created September 21, 2011 08:26
Django class based view mixins
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
class NeverCacheMixin(object):
@method_decorator(never_cache)