Skip to content

Instantly share code, notes, and snippets.

View SamDecrock's full-sized avatar
🏠
Working from home

Sam SamDecrock

🏠
Working from home
View GitHub Profile
/**************************************************************************/
/*!
This example attempts to dump the contents of a Mifare Ultralight card
Note that you need the baud rate to be 115200 because we need to print
out the data and read from the card at the same time!
To enable debug message, define DEBUG in PN532/PN532_debug.h
Edited by Sam Decrock to read out Mifare Ultralight cards
@SamDecrock
SamDecrock / raw_neopixel_rfduino.ino
Last active February 20, 2017 03:23
Controls a NeoPixel using an RFDuino board with functions that resemble the NeoPixel API
// WS2812_RFduino_Test
// By Thomas Olson
// teo20140220.01
// teo20140719.01 Modified for Arduino 1.5.7
// 20141022.. verified works with Arduino 1.5.8
// No complicated Pixel Library needed.
// Tested with WS2812B 4 pin versions.
// Modified by Sam Decrock to resemble NeoPixel API
const int ws2812pin = 6;
@SamDecrock
SamDecrock / removeadobe.sh
Created March 25, 2016 12:11
Purge Adobe stuff from your Mac
rm -rf "/Users/Shared/Library/Application Support/Adobe"
rm -rf "/Library/Application Support/regid.1986-12.com.adobe"
rm -rf "/Library/Application Support/Adobe"
rm -rf "/Library/Caches"
rm -rf "~/.adobe"
rm -rf "~/Library/Preferences/Adobe"
rm -rf "~/Library/Preferences/com.adobe.crashreporter.plist"
rm -rf "~/Library/Logs"
rm -rf "~/Library/Caches"
rm -rf "~/Library/Application Support/Adobe"
@SamDecrock
SamDecrock / echobuttons1.js
Last active July 26, 2022 20:05
Connecting to an Amazon Echo Button
var btSerial = new (require('bluetooth-serial-port')).BluetoothSerialPort();
var address = '50-dc-e7-a3-0b-e8';
btSerial.findSerialPortChannel(address, function(channel) {
btSerial.connect(address, channel, function() {
console.log('> connected to ' + address);
btSerial.on('data', function(buffer) {
console.log('> receiving ('+buffer.length+' bytes):', buffer);
@SamDecrock
SamDecrock / csv2json.js
Last active July 9, 2018 14:50
Conversts json (or any other seperated data) to an array of json objects (provided that there's a row with header information)
function csv2jsonObjects (csv) {
var lines = csv.split('\n');
var keys = [];
var json = [];
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var parts = line.split(';');
// this one liner starts a TCP server on port 3000 and spits out all the data it receives
// just run `node` from the command line and past the following:
require('net').createServer(function(socket) { socket.on('data', function(data) { console.log(data.toString()) }); }).listen(3000);
Location
System configuration (wpe-raspberrypi) System hostame (change the hostname)
System configuration /bin/sh (bash) (use bash instead of sh)
Kernel Linux Kernel Tools gpio
Target packages Show packages that are also provided by busybox
Target packages Audio and video applications bluez-alsa
Target packages Development tools git
Target packages Development tools git-crypt
Target packages Development tools grep
Target packages Development tools make
Operation Location value
ENABLE Target packages Filesystem and flash utilities dosfstools
ENABLE Target packages Filesystem and flash utilities mtools
ENABLE Filesystem images ext2/3/4 root filesystem
SET VALUE Filesystem images ext2/3/4 root filesystem ext2/3/4 variant ext4
DISABLE Filesystem images initial RAM filesystem linked into linux kernel
ENABLE Host utilities genimage
@SamDecrock
SamDecrock / nginx-webradio-forwarding.conf
Created June 10, 2019 08:37
Nginx configuration to forward a web radio
server {
listen 80;
server_name 104.248.213.228 koit.mydomain.com;
access_log /var/log/nginx/koitfm.access.log;
error_log /var/log/nginx/koitfm.error.log;
root /var/www/koitfm/;
location /KOITFM {
resolver 8.8.8.8; # may or may not be necessary.
[Unit]
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=samd
ExecStart=/usr/bin/socat tcp-listen:2022,reuseaddr,fork tcp:168.128.12.244:22