Skip to content

Instantly share code, notes, and snippets.

View dacoffey's full-sized avatar
😎
BLAZING FAST!! 😂

David Adam Coffey dacoffey

😎
BLAZING FAST!! 😂
View GitHub Profile
anonymous
anonymous / imgur_random.html
Created December 29, 2013 05:17
Quick-and-Dirty Image Randomizer using JavaScript and Imgur's RESTful API
<!DOCTYPE html>
<html>
<body>
<script>
// I've omitted my Imgur client ID. You'll need to create and account and register your app which will give access to the API.
client_id="[omitted]"
auth_url="https://api.imgur.com/3/gallery/random/random/"
@balloob
balloob / demo.js
Created August 1, 2017 15:50
Example using home-assistant-js-websocket with Node
const WebSocket = require('ws');
global.WebSocket = WebSocket;
const HAWS = require("home-assistant-js-websocket");
const getWsUrl = haUrl => `ws://${haUrl}/api/websocket`;
HAWS.createConnection(getWsUrl('localhost:8123')).then(conn => {
HAWS.subscribeEntities(conn, logEntities);
});
@dacoffey
dacoffey / dnsmasq.conf
Last active March 17, 2021 02:48
DNSMASQ: Block HIBP API HX Home Assistant
address=/api.pwnedpasswords.com/
@dacoffey
dacoffey / git-undo.sh
Last active April 11, 2021 06:17
GIT: Undo Last Commit
git reset HEAD~1
@dacoffey
dacoffey / settings.json
Last active August 26, 2021 13:53
VSCODE: Colors
"editor.tokenColorCustomizations": { "comments": "#c0c0c0" }
"workbench.colorCustomizations": {
"terminal.foreground" : "#ffffff",
"terminal.background" : "#000000",
"terminal.ansiRed": "#ff8888",
"terminal.ansiBrightBlack": "#aaaaaa"
}
@balloob
balloob / sensor_example.py
Last active November 23, 2021 16:31
Example platforms and automation component for Home Assistant
"""
Copy this file to <config_dir>/example/sensor.py
Add to your configuration.yaml:
sensor:
platform: example
"""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
@bsatrom
bsatrom / hook_stdout.coffee
Created November 8, 2011 21:56
Samples for hooking into STDOUT for unit testing in Node.js
exports = module.exports
exports.setup = (callback) ->
write = process.stdout.write
process.stdout.write = ((stub) ->
(string, encoding, fd) ->
stub.apply process.stdout, arguments
callback string, encoding, fd)(process.stdout.write)
@Jiab77
Jiab77 / ntopng-install-on-ubuntu-server-18.04.md
Last active October 16, 2022 05:06
Ntop-ng Install on Ubuntu Server 18.04 (written for Raspberry Pi but can be used on any other platforms)

Ntop-ng Install on Ubuntu Server 18.04

Instructions are written for Raspberry Pi but can be used on any other platforms.

As there is no pre-built packages for ARM platforms I've found some packages but you might have no other choices than do the compilation yourself... 😅

Pre-Built packages

I've finally been able to get the hand on their pre-built packages... I've just read too fast their documentation... :face_palm:

You could find their packages here: http://packages.ntop.org/

@kraftb
kraftb / I2C_Adapter.ino
Created May 19, 2015 15:31
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
@dacoffey
dacoffey / app.js
Created March 23, 2021 05:58
NODE: Bare Minimum Web Server
require('http').createServer((req,res)=>{ res.writeHead(200); res.end('HELLOWORLD'); }).listen(80,'0.0.0.0');