Skip to content

Instantly share code, notes, and snippets.

View TechplexEngineer's full-sized avatar

Blake Bourque TechplexEngineer

View GitHub Profile
@TechplexEngineer
TechplexEngineer / TC74.c
Created March 5, 2014 18:14
Helpful code for using Microchip's TC74 I2C temperature sensors on the Raspberry Pi
/*!
* @file
*
* @brief Library for the TC47A* I2C temperature sensors
*
* @author Blake Bourque
*
* @date Mar 5, 2014
*
* Provides readTempInC and readTempInF
@TechplexEngineer
TechplexEngineer / readme.md
Created March 5, 2014 18:16
Fixing Pango-WARNING error after installing wine/mscorettfonts

If you are getting an error similar to this:

Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is 'Arial Bold 19.53125' at /usr/lib64/perl5/vendor_perl/dpm/canvas_module.pm line 253.
Pango-WARNING **: font_face status is: out of memory at /usr/lib64/perl5/vendor_perl/dpm/canvas_module.pm line 253.
Pango-WARNING **: scaled_font status is: out of memory at /usr/lib64/perl5/vendor_perl/dpm/canvas_module.pm line 253.
Pango-WARNING **: shaping failure, expect ugly output. shape-engine='BasicEngineFc', font='Arial Bold 19.53125', text=' 3R ' at /usr/lib64/perl5/vendor_perl/dpm/canvas_module.pm line 253.

The fix:
$ cd /usr/share

@TechplexEngineer
TechplexEngineer / howto.md
Last active July 8, 2016 19:27
Dynamic Domain Name Service (DDNS) with Namecheap and DD-WRT
Field Name Value
DDNS Service Custom
Do not use external ip check No
DYNDNS Server dynamicdns.park-your-domain.com
User Name username (is not used)
Password <alphanumeric string from Namecheaps Dynamic DNS page>
Host Name <specify the subdomain. For example given test.example.com just specify test. To use DDNS on the naked domain specify @. Multiple entries can be separated by adding a -a >
URL /update?domain=<example.com>&password=<same as the above password>
Additional DDNS Options \
@TechplexEngineer
TechplexEngineer / i2c.md
Last active August 29, 2015 13:57
Raspberry PI I2C setup

Note to the reader: Code blocks beginning with a $ are commands to be run on a RPI Rasbian shell.

  1. Enable I2C support
    1. add i2c-dev to the end of /etc/modules
    2. comment out (with a #) the line that says blacklist i2c-bcm2708 in /etc/modprobe.d/raspi-blacklist.conf
  2. Enable the current user to access I2C hardware
    1. install i2c-tools (includes i2cdetect and adds the i2c group) with: $ sudo apt-get update && sudo apt-get install i2c-tools
    2. add the current user to the i2c group with: $ sudo adduser <USER> i2c where <USER> is the username to add to the i2c group
  3. Get the chip-address on the bus of a connected device
    1. $ i2cdetect -y i2cbus Where:
@TechplexEngineer
TechplexEngineer / cgi.md
Created March 6, 2014 03:21
Run CGI Scripts on a Raspberry Pi with light httpd

Setting up your Pi for CGI

lines starting with a $ indicate a command to run

  1. Make sure you have I2C setup on your PI
  2. $ sudo apt-get install lighttpd # install a web server
  3. $ sudo usermod -aG i2c www-data # add the cgi user to the i2c group
  4. $ mkdir -p /var/www/cgi-bin # create the cgi-bin folder
@TechplexEngineer
TechplexEngineer / setup.md
Last active August 29, 2015 13:57
List of software and configurations to make after installing Ubuntu
  • Install
    • Vim sudo apt-get install vim
    • Git sudo apt-get install git
    • Sublime
    • Nodejs
    • Dropbox
    • Copy
    • Wine
      • Microcap
  • Generate SSH Key
@TechplexEngineer
TechplexEngineer / 20-avrispmkii.rules
Created March 27, 2014 12:32
Put this file in ```/etc/udev/rules.d/20-avrispmkii.rules``` then restart the udev service to use the avrispmkII programmer.
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
@TechplexEngineer
TechplexEngineer / makefile
Created March 27, 2014 12:34
Sample AVR makefile, just change the TARGET variable to the name of your main code. ie: if your code is main.c TARGET=main
CC=avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=atmega88
OBJ2HEX=avr-objcopy
#UISP=/usr/local/bin/uisp
TARGET=main
#ADFLAGS=-p m8 -c FT232 -P /dev/tty.usbserial-A8003POq
ADFLAGS=-p m88 -c avrispmkII -P usb
# .PHONY means that these are not a target
.PHONY: fuses prog erase
@TechplexEngineer
TechplexEngineer / main.c
Created March 27, 2014 12:35
Simple code to blink LEDs on an AVR atMega88A
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 1000000UL //processor frequency 1MHz
#include <util/delay.h>
#include <stdbool.h>
#define output_low(port,pin) port &= ~(1<<pin)
#define output_high(port,pin) port |= (1<<pin)
#define set_input(portdir,pin) portdir &= ~(1<<pin)
@TechplexEngineer
TechplexEngineer / gist:9894031
Created March 31, 2014 14:47
Pulling USFIRST Data
http://www.chiefdelphi.com/forums/showpost.php?p=1366469&postcount=6