Skip to content

Instantly share code, notes, and snippets.

@hwdsl2
hwdsl2 / .MOVED.md
Last active April 18, 2024 01:37
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@ChickenProp
ChickenProp / gist:3231712
Created August 2, 2012 00:02
Briefly: using an Adafruit LED Matrix with the Raspberry Pi

Adafruit sells an 8x8 LED matrix which you can control from a Raspberry Pi using I2C. Unfortunately they only provide Arduino code; I've only used I2C through the programs i2cset, i2cget, i2cdump and i2cdetect available from the i2c-tools package; and it wasn't immediately obvious how to use Adafruit's code to control the matrix from the Pi.

Fortunately, it turns out to be quite simple. i2c-tools seems to assume a register-based model of I2C devices, where the target device has up to 256 pointers which can be read and written. This doesn't seem to suit the HT16K33 chip (datasheet) that the matrix backpack uses. For example, when I ran i2cdump, which gets the value of each register, it started to blink a picture at me. At least I knew it was working.

Setting individual LEDs works much as you might expect. Every row has a single register, the eight bits of that register correspond to the eight LEDs on

@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong