Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
BLAZING FAST!! 😂

David Adam Coffey dacoffey

😎
BLAZING FAST!! 😂
View GitHub Profile
@ianfinch
ianfinch / rpi4-usb.sh
Last active Oct 22, 2021
Raspberry Pi 4 USB Gadget
View rpi4-usb.sh
#!/bin/bash
# Set up a Raspberry Pi 4 as a USB-C Ethernet Gadget
# Based on:
# - https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/
# - https://pastebin.com/VtAusEmf
if ! $(grep -q dtoverlay=dwc2 /boot/config.txt) ; then
echo "Add the line dtoverlay=dwc2 to /boot/config.txt"
exit
fi
@bsatrom
bsatrom / hook_stdout.coffee
Created Nov 8, 2011
Samples for hooking into STDOUT for unit testing in Node.js
View hook_stdout.coffee
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)
@nhtua
nhtua / 00.install-android-sdk.sh
Last active Oct 13, 2021
Run a Headless Android Device on Ubuntu server (no GUI)
View 00.install-android-sdk.sh
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version
@dacoffey
dacoffey / settings.json
Last active Aug 26, 2021
VSCODE: Colors
View settings.json
"editor.tokenColorCustomizations": { "comments": "#c0c0c0" }
"workbench.colorCustomizations": {
"terminal.foreground" : "#ffffff",
"terminal.background" : "#000000",
"terminal.ansiRed": "#ff8888",
"terminal.ansiBrightBlack": "#aaaaaa"
}
@Jiab77
Jiab77 / ntopng-install-on-ubuntu-server-18.04.md
Last active Aug 12, 2021
Ntop-ng Install on Ubuntu Server 18.04 (written for Raspberry Pi but can be used on any other platforms)
View ntopng-install-on-ubuntu-server-18.04.md

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/

@hawkins
hawkins / screen.js
Created Jan 16, 2017
Node.js blessed screen - keep your output separate from your input!
View screen.js
/*
* I've used blessed to create a textbox at the bottom line in the screen.
* The rest of the screen is the 'body' where your code output will be added.
* This way, when you type input, your program won't muddle it with output.
*
* To try this code:
* - $ npm install blessed --save
* - $ node screen.js
*
* Key points here are:
@dacoffey
dacoffey / app.js
Created Mar 23, 2021
NODE: Bare Minimum Web Server
View app.js
require('http').createServer((req,res)=>{ res.writeHead(200); res.end('HELLOWORLD'); }).listen(80,'0.0.0.0');
@dacoffey
dacoffey / git-undo.sh
Last active Apr 11, 2021
GIT: Undo Last Commit
View git-undo.sh
git reset HEAD~1
@dacoffey
dacoffey / dnsmasq.conf
Last active Mar 17, 2021
DNSMASQ: Block HIBP API HX Home Assistant
View dnsmasq.conf
address=/api.pwnedpasswords.com/
@balloob
balloob / demo.js
Created Aug 1, 2017
Example using home-assistant-js-websocket with Node
View demo.js
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);
});