Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
for f in `ls -tr *.mov| sed "s/\.[^\.]*$//"`; do
#echo "$f" >> filelist.txt
ffmpeg -i "$f.mov" -target ntsc-dvd "$f.mpg" -threads 16
cat "$f.mpg" >> output.mpg
done
mkdir -p $1/mobile/video
mkdir -p $1/veryHigh/video
mkdir -p $1/high/video
mkdir -p $1/medium/video
#!/bin/sh
# Uses 'inoticoming' to efficiently monitor a directory and call an upload script.
#
# Usage:
# Remember to set the variables at the top of the script files.
# Can be run directly or at startup by adding lines to /etc/rc.local (Debian) example:
# sudo -b -u www-data /path/to/YouTubeMonitor.sh MONITOR_DIR COMPLETE_DIR [PLAYLIST_ID]
# Add one monitor line per directory/playlist.
# Now simply drop files into the monitored directory and they will be uploaded, named, tagged and playlisted.
#

Introduction

The MCP23017 is an I/O expander chip. It has 16 GPIO pins which you can control using an I2C interface using two pins from a Raspberry Pi, plus a power source and sink (which can also come from the Pi). It's not quite as simple as directly controlling the Pi's GPIO pins, but it's not complicated, either.

You need to install i2c-tools, which is probably in your distribution's package manager. You also need a kernel with I2C support; you might need to modprobe i2c-dev. It would presumably be possible to do without either of these things, and bitbang the I2C protocol over GPIO, but I don't understand the protocol well enough to try.

On pin numbering: if you like, you can refer to the datasheet for the MCP23017. There's a small dot in one corner of the chip, with a semi-circular cut-out at that end. The pin near

Introduction

The MCP23017 is an I/O expander chip. It has 16 GPIO pins which you can control using an I2C interface using two pins from a Raspberry Pi, plus a power source and sink (which can also come from the Pi). It's not quite as simple as directly controlling the Pi's GPIO pins, but it's not complicated, either.

You need to install i2c-tools, which is probably in your distribution's package manager. You also need a kernel with I2C support; you might need to modprobe i2c-dev. It would presumably be possible to do without either of these things, and bitbang the I2C protocol over GPIO, but I don't understand the protocol well enough to try.

On pin numbering: if you like, you can refer to the datasheet for the MCP23017. There's a small dot in one corner of the chip, with a semi-circular cut-out at that end. The pin near

@nazt
nazt / Notes.md
Created November 15, 2013 09:22 — forked from glennschler/Notes.md

Notes

Install of Wheezy-Raspbian v2013-09-25

Configure Raspberry Pi from Mac OS X

  • Download Raspbian Raw image
  • From the OS X command line. Following these eLinux SD Card Setup. To summarize:
    • diskutil list
      • identify the disk (not partition) of your SD card. e.g. disk4 (not disk4s1)
    • diskutil unmountDisk /dev/<disk# from diskutil>
  • e.g. diskutil unmountDisk /dev/disk3
@nazt
nazt / ddd
Created November 20, 2013 18:33 — forked from allfake/ddd
// Control an 8x8 LED display with 2 x 74HC595 shift registers
// Using only 3 pins from the Arduino
// shift register = 8 pin
#include <string.h>
#define DEVICES 6
#define SHIFT_REGISTER 8
#define ALLFPIN SHIFT_REGISTER * DEVICES
@nazt
nazt / Pebble.ino
Created January 9, 2014 12:34 — forked from southwolf/Pebble.ino
#include <string.h>
#include <ctype.h>
#include <SoftwareSerial.h>
// the Bluetooth Shield connects to Pin D9 & D10
SoftwareSerial bt(9,10);
const uint8_t req[5] = {0x00, 0x01, 0x00, 0x11, 0x00};
const uint8_t cap[17] = {0x00, 0x0d, 0x00, 0x11, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32};
const uint8_t ping[9] = {0x00, 0x05, 0x07, 0xd1, 0x00, 0xde, 0xad, 0xbe, 0xef};
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
//// The following define selects which electronics board you have. Please choose the one that matches your setup
// MEGA/RAMPS up to 1.2 = 3,
// RAMPS 1.3/1.4 = 33
// Gen6 = 5,
// Gen6 deluxe = 51
@nazt
nazt / 0_reuse_code.js
Created June 2, 2014 15:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console