Skip to content

Instantly share code, notes, and snippets.

@aarmot
aarmot / Makefile
Last active December 11, 2015 01:39
Makefile for MSP430 assembler development in Linux. Inspiration taken from http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Example:Makefile
#
# Makefile for msp430 assembler
# Build single GNU asm source
#
# 'make' builds everything
# 'make dump' generates assembler dump of target
# 'make burn' flashes target into launchpad
# 'make clean' deletes everything except source files and Makefile
#
# You need to set TARGET and MCU for your project
@aarmot
aarmot / pwm.c
Last active November 15, 2023 17:05
MSP430 PWM duty cycle drift demo
#include "msp430.h"
/*
Simple PWM generator using Timer A
Output P1.0, PWM period about 2 ms
Duty cycle changes gradually from 5% to 95%
Compiled with msp430-gcc
aarmot 2013-01-16
#include "msp430.h"
/*
BLDC motor driver ver1
P2.0 P2.1 P2.2 go through cycle
010
011
001
101
@aarmot
aarmot / Makefile
Created January 23, 2013 11:27
Makefile for MSP430 development in Linux. Inspiration taken from http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Example:Makefile
#
# Makefile for msp430
#
# 'make' builds everything
# 'make lst' generates assembly listings of each source
# 'make dump' generates assembler dump of target
# 'make burn' flashes target into launchpad
# 'make clean' deletes everything except source files and Makefile
#
# You need to set TARGET, MCU and SOURCES for your project.
@aarmot
aarmot / .SciTEUser.properties
Created February 19, 2013 23:13
SciTE properties for GNU assembler MSP430 source syntax highlighting. Copy the content to .SciTEUser.properties and modify to your liking.
# Show .s and .S asm sources in file open dialog
source.files=*.asm;*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hxx;*.hpp;\
*.rc;*.rc2;*.def;*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.conf;\
Make*;make*;*.mak;*.properties;*.html;*.xml;*.iface;*.bat;\
*.s;*.S;*.dump;*.haml
# GNU asm file
file.patterns.gasm=*.s;*.S;*.dump
filter.gasm=GNU Assembler (asm)|$(file.patterns.gasm)|
lexer.$(file.patterns.gasm)=asm
@aarmot
aarmot / nas-install.sh
Last active December 16, 2015 01:49
OpenWRT NAS conf
#!/bin/sh
# Configure OpenWrt NAS
# Attached USB drive is accessible through
# 1. http://nasbox/A
# 2. CIFS - //nasbox/A
# 3. DLNA
# where "nasbox" is your router name and "A" represents one of the mountpoints below
@aarmot
aarmot / 30-minidlna
Last active October 12, 2023 07:11
Hotplug2 script to automatically start minidlna every time the USB disk gets attached and stop minidlna when disk gets detached. Configuration parameters are at the top of script.
#!/bin/sh
# Hotlug2 script which starts minidlna when USB disk gets attached
# [email protected]
# Sharing: GPLv3 or later
# To handle minidlna startup through hotplug you should disable minidlna autostart
# /etc/init.d/minidlna disable
# and copy current script to /etc/hotplug.d/block/30-minidlna
@aarmot
aarmot / adblock
Last active September 7, 2016 18:04
Adblock skript for OpenWrt. Tested on Attitude Adjustment 12.09
#!/bin/sh /etc/rc.common
# Copy this skript to /etc/init.d/adblock and enable:
# chmod +x /etc/init.d/adblock
# /etc/init.d/adblock enable
START=90
ADS='http://pgl.yoyo.org/as/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext'
@aarmot
aarmot / redir.lua
Created August 12, 2013 14:53
Primitive daemon, which listens on port 80 and replies with http redirect Requires luasocket and luadaemon
-- HTTP redirect daemon
local port = 80
local redir = "HTTP/1.0 301 Moved Permanently\nLocation: https://example.org/\n\n"
local socket = require("socket")
local daemon = require("daemon")
daemon.daemonize()
local server = assert(socket.bind("*", port))
@aarmot
aarmot / bbb-customsetup.sh
Created December 29, 2013 17:19
BeagleBone Black Ubuntu custom setup
# To reduce eMMC wear remap write-intensive directories to memory fs
# Mount /tmp into tmpfs
sudo echo "tmpfs /tmp tmpfs defaults 0 0" >> /etc/fstab
sudo rm -rf /var/tmp && ln -s /tmp /var/tmp
# Mount /var/log into tmpfs
sudo cat > /etc/init/mount-log.conf <<EOT