Skip to content

Instantly share code, notes, and snippets.

@mavenius
mavenius / build_number.js
Last active April 22, 2016 13:25 — forked from Evanion/build_number.js
Build number hook
#!/usr/bin/env node
// Based on the 'replace text' hook found here: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/
// This hook should be placed in the 'after_prepare' hook folder.
// The hook relies on a JSON file located at '<project_root>/resources/build_number.json' to track the build number.
// build.json content:
// { "major": 1, "minor": 2, "build": 3 }
// this example would generate build number "1.2.4" (because the build is incremented before, so build_number.json reflects the most recent build.)
@mavenius
mavenius / dash-listen-3.py
Last active August 17, 2016 18:05 — forked from schwark/dash-listen-3.py
Amazon Dash Button ARP listener script (not written by me)
#!/usr/bin/python
# Adapted from original written by Bob Steinbeiser (https://medium.com/@xtalker)
import socket
import struct
import binascii
def tide_button(arp_detailed):
dest_ip = socket.inet_ntoa(arp_detailed[8])
print 'Tide button pressed, IP = ' + dest_ip
@mavenius
mavenius / dashbutton.py
Created September 11, 2016 16:32 — forked from mr-pj/dashbutton.py
if dhcp request matches a given mac, an action will be taken. Requires pydhcplib
from pydhcplib.dhcp_network import *
def do_something():
print("button has been pressed")
netopt = {'client_listen_port':"68", 'server_listen_port':"67", 'listen_address':"0.0.0.0"}
class Server(DhcpServer):
def __init__(self, options, dashbuttons):