Skip to content

Instantly share code, notes, and snippets.

// Regular commander.js logic up here. None of this
// logic is run if a subcommand match was found
var knownSubCommands = [
"blah",
"ha",
"etc"
]
@eugenehp
eugenehp / reverse-ip-lookup.js
Created July 8, 2012 14:58
node.js IP reverse lookup
var dns = require('dns');
function reverseLookup(ip) {
dns.reverse(ip,function(err,domains){
if(err!=null) callback(err);
domains.forEach(function(domain){
dns.lookup(domain,function(err, address, family){
console.log(domain,'[',address,']');
console.log('reverse:',ip==address);
@integrii
integrii / RaZberry API Command Examples
Last active November 22, 2022 13:03
RaZberry API ZAutomation/ZAPI Examples
# I had a LOT of trouble finding working examples of the ZAutomation API for RaZberry API. I eventually figured out what exactly to use by combining information from multiple sources and sniffing requests from the 'Expert UI'. Some areas I found information:
- http://docs.zwayhomeautomation.apiary.io/
- http://wiki.micasaverde.com/index.php/ZWave_Command_Classes
- https://www.npmjs.org/package/mqtt-zway
- The included PDFs
- The expert API area on the device web UI
- https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo?hl=en (Postman POST/GET sniffer)
# Some general RaZberry API commands:
@urodoz
urodoz / haproxy.cfg
Created April 14, 2017 21:45
Multiple SSL certificates in HAProxy configuration
global
maxconn 2048
defaults
mode http
timeout connect 5000ms
timeout client 90000ms
timeout server 90000ms
frontend secure-http-in
@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Created September 24, 2016 21:46
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@jfromaniello
jfromaniello / gist:8418116
Last active September 19, 2023 23:38
Example of authenticating websockets with JWTs.
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 8080});
var jwt = require('jsonwebtoken');
/**
The way I like to work with 'ws' is to convert everything to an event if possible.
**/
function toEvent (message) {
try {
@lg
lg / uap-ac-lite-openwrt.txt
Last active October 22, 2023 12:16
making the ubnt wifi awesome (uap ac lite) w/ openwrt
making the ubnt wifi awesome (uap ac lite) w/ lede (openwrt)
the reasons you would do this:
- you get 802.11r
- you get better roaming
- you get access to some new 5ghz channels
I AM NOT TO BE HELD RESPONSIBLE FOR ANYTHING IN HERE. DO AT YOUR OWN RISK. THANK YOU AND HAVE A LOVELY DAY.
** note that though we're using Lede, it's essentially openwrt minus the drama
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@omenlabs
omenlabs / sainsmart_16_relay.py
Last active February 18, 2024 06:31
Example code for driving the Sainsmart 16-Channel 9-36V USB Relay Module (Product 101-70-208)
#!/usr/bin/env python3
"""
Example code for driving the Sainsmart 16-Channel 9-36V USB Relay Module (Product 101-70-208)
Documents for this module were found at:
https://s3.amazonaws.com/s3.image.smart/download/101-70-208/101-70-208.zip
The protocol appears to be MODBUS ASCII:
https://en.wikipedia.org/wiki/Modbus#Protocol_versions
@davidhemphill
davidhemphill / gist:5188894
Created March 18, 2013 17:09
How to do a Git clone without the .git directory
// Clone the repo
git clone --depth=1 git://someserver/somerepo dirformynewrepo
// Remove the .git directory
rm -rf !$/.git