Skip to content

Instantly share code, notes, and snippets.

@ovace
ovace / webserver.go
Created October 18, 2017 17:05 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010-2014 Alexis ROBERT <alexis.robert@gmail.com>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import "net/http"
import "net/url"
@ovace
ovace / gist:6a374433f2d83c7a84d920bb0a79b9bd
Created April 15, 2018 17:19 — forked from bhurlow/gist:3043629
Linux Screen Cheat Sheets
–ctrl a c -> cre­ate new win­dow
–ctrl a A -> set win­dow name
–ctrl a w -> show all win­dow
–ctrl a 1|2|3|… -> switch to win­dow n
–ctrl a ” -> choose win­dow
–ctrl a ctrl a -> switch between win­dow
–ctrl a d -> detach win­dow
–ctrl a ? -> help
–ctrl a [ -> start copy, move cur­sor to the copy loca­tion, press ENTER, select the chars, press ENTER to copy the selected char­ac­ters to the buffer
–ctrl a ] -> paste from buffer
@ovace
ovace / min-char-rnn.py
Created September 24, 2018 16:51 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ovace
ovace / gist:bea07eb0f52ee2a8fe755658f430d7ff
Created October 7, 2018 22:31 — forked from frostney/gist:4165353
Walking through folder recursively async (node.js): includes option to filter elements, hidden dot files and filenames with trailing underscore. (walkFiles function taken from http://stackoverflow.com/questions/7041638/walking-a-directory-with-node-js)
var path = require('path');
var fs = require('fs');
var es6shim = require('es6-shim');
/**
* dir: path to the directory to explore
* action(file, stat): called on each file or until an error occurs. file: path to the file. stat: stat of the file (retrived by fs.stat)
* done(err): called one time when the process is complete. err is undifined is everything was ok. the error that stopped the process otherwise
*/
var walkFiles = function(dir, action, done) {
@ovace
ovace / package.json
Created November 29, 2018 22:18 — forked from jthomas/package.json
Using TensorFlow.js with MobileNet models for image classification on Node.js
{
"name": "tf-js",
"version": "1.0.0",
"main": "script.js",
"license": "MIT",
"dependencies": {
"@tensorflow-models/mobilenet": "^0.2.2",
"@tensorflow/tfjs": "^0.12.3",
"@tensorflow/tfjs-node": "^0.1.9",
"jpeg-js": "^0.3.4"
@ovace
ovace / nrftest.js
Created March 17, 2019 16:03
Example of using the nRF24L01+ with Node.js on the Raspberry Pi
var spiDev = "/dev/spidev0.0";
var cePin = 24;
var irqPin = 25;
var nrf = require('nrf');
var radio = nrf.connect(spiDev, cePin, irqPin); // Connect to the radio
radio.channel(0x4c); // Set channel to 76
radio.dataRate('1Mbps') // Set data rate to 1Mbps
radio.crcBytes(2) // Set the CRC to 2
radio.autoRetransmit({
@ovace
ovace / README.md
Created July 14, 2019 14:44 — forked from willprice/README.md
Install OpenCV 4.1.0 for Raspberry Pi 4 (Raspbian Buster)

Install OpenCV 4.1.0 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.0/build
$ sudo make install
@ovace
ovace / services-start.sh
Created June 6, 2020 15:45 — forked from Jimmy-Z/services-start.sh
multi SSID with VLAN script, for ASUS AC86U with merlin
#!/bin/sh
# multi SSID with VLAN script, for ASUS AC86U with merlin
#
# setup before hand:
# set "router" to "AP Mode"
# this will put all ports and wireless in br0
# create 2 guest network
# enable Administration => System => Enable JFFS custom scripts and configs
# put this script in /jffs/scripts/, name should be "services-start"
@ovace
ovace / esp8266-esp01-relay-web-mqtt.ino
Created August 21, 2020 01:22 — forked from jeroavf/esp8266-esp01-relay-web-mqtt.ino
ESP8266 ESP-01 relay control using Web server or MQTT
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* wifi_ssid = "XXXXX";
const char* wifi_password = "XXXXX";
char* mqtt_server = "iot.eclipse.org";
char* mqtt_user = "";
@ovace
ovace / Livingroom.flow
Created May 26, 2021 01:05 — forked from happytm/Livingroom.flow
Node-Red RPIEasy Home Automation Flow
{
"id": "567d64ec.2661bc",
"label": "Livingroom",
"nodes": [
{
"id": "98b02e48.6b436",
"type": "switch",
"z": "567d64ec.2661bc",
"name": "Livingroom",
"property": "topic",