Skip to content

Instantly share code, notes, and snippets.

///////////////////////////////////////////////////INITIALIZE VARIABLES
var express = require('express')
const url = require('url');
var app = express()
var SerialPort = require("serialport");
var path = require('path');
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var port = process.env.PORT || 3000;
const Readline = require('@serialport/parser-readline');
@lkishfy
lkishfy / LaunchChromeStartNode.command
Created November 13, 2018 14:05
LaunchChromeStartNode.command
#!/bin/bash
sleep 10
open -a /Applications/Google\ Chrome.app --args --kiosk --incognito http://localhost:3000
node filepath/server.js
@lkishfy
lkishfy / Node-UDP.maxpat
Created November 1, 2018 17:00
Node-UDP Example Max Patch
{
"boxes" : [ {
"box" : {
"maxclass" : "message",
"text" : "1",
"id" : "obj-22",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 394.0, 335.0, 29.5, 22.0 ],
"outlettype" : [ "" ]
@lkishfy
lkishfy / RandomSubpatch.txt
Created October 30, 2018 14:41
Random Subpatch
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "if $i1 > 21 && $i1 < 26 && $i2 > 21 && $i2 < 26 then bang",
"patching_rect" : [ 376.399993896484375, 679.00006103515625, 315.0, 22.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"id" : "obj-31",
"outlettype" : [ "" ]
@lkishfy
lkishfy / StateMachine.ino
Created October 12, 2018 19:34
State Machine Example
const int redLightPin = 12; // Set the red light's pin number.
const int yellowLightPin = 11; // Set the yellow light's pin number.
const int greenLightPin = 10; // Set the green light's pin number.
const int pedestrianRedLightPin = 3;
const int pedestrianGreenLightPin = 2;
const int buttonPin = 4;
// Create constant values (they can't be changed) that represent our 4 discrete states.
@lkishfy
lkishfy / Turn Off Pinch Zoom.js
Created August 27, 2018 00:24
Turn Off Pinch Zoom on Touch Screens
document.addEventListener('touchmove', function(e) {e.preventDefault()}, {passive:false});
//Turn off pinch zoom
document.addEventListener('touchstart', function(e) {
if (e.touches.length > 1){
e.preventDefault();
}
}, {passive: false});
@lkishfy
lkishfy / Example UDP Node Server.js
Created August 27, 2018 00:11
Node Server for reading and emitting UDP Datagrams from server to client with Socket.IO
///////////////////////////////////////////////////INITIALIZE VARIABLES
var express = require('express')
const url = require('url');
var app = express()
var $ = require('jquery');
var dgram = require('dgram');
var udpServer = dgram.createSocket('udp4');
var PORT = 41234;
var HOST = '127.0.0.1';
var SerialPort = require("serialport");
@lkishfy
lkishfy / Node Startup Time of Year.bat
Created August 26, 2018 23:33
Node Startup Script that changes CD based on time of year
@echo off
set summer=false
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set year=%dt:~0,4%
set month=%dt:~4,2%
set day=%dt:~6,2%
if %month%==01 set monthname=January
if %month%==02 set monthname=Febuary
if %month%==03 set monthname=March
@lkishfy
lkishfy / Example Node Startup Script.bat
Created August 26, 2018 23:30
Example Node Startup Script
title App Title
cd C:\Users\Lou\Documents\GitHub\Repository\Src
echo Launching Exhibit...
start "Chrome" "C:\Program Files (x86)\Google\Chrome\Application/chrome.exe" --kiosk --incognito http://localhost:8080 --start-fullscreen
node start.js
@lkishfy
lkishfy / Run Virtual Machine.bat
Last active August 30, 2018 19:10
Start Virtual Machine on Boot (Also shows how to run a .ps1 when elevated permissions are necessary)
PowerShell -NoProfile -ExecutionPolicy Unrestricted -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Unrestricted -File ""C:\Users\Lou\Desktop\startVM.ps1""' -Verb RunAs}";