Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@nazt
nazt / setup.sh
Created June 19, 2014 02:05 — forked from BloodAxe/setup.sh
# Prepare system
apt-get update
apt-get upgrade
apt-get install build-essential
apt-get install cmake
apt-get install git
apt-get install pkg-config
# Grab frest opencv library
curl -sL https://github.com/Itseez/opencv/archive/master.zip > opencv.zip
@nazt
nazt / monitrc
Created July 30, 2014 00:04 — forked from franck/monitrc
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file, a complete list of statements and
## options please have a look in the monit manual.
@nazt
nazt / README.md
Last active August 29, 2015 14:12 — forked from adamvr/README.md

Openwrt scripts

A couple of scripts for publishing the state of an openwrt router to mqtt.

Relies on mosquitto_pub and mosquitto_sub being present

init

Init.d scripts including one to start a pair of file monitors and one to publish whether or not the router is onlien

#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@nazt
nazt / piomp.c
Last active August 29, 2015 14:15 — forked from anonymous/gist:7d3c15a875e786a79349
piomp.c
#include <stdio.h>
#include <omp.h>
static long num_steps = 99999999;
double step,start = 0.0,stop = 0.0;
#define NUM_THREADS 8
int main ()
{
double pi;
/*
You'll need the information below, get these after adding a device. I'm using the MAC address as the device's ID.
org=[org-id]
type=[device-type]
id=[device-id]
auth-method=token
auth-token=[auth-token]
*/
#!/bin/bash
# Slightly modified version from https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh
# Run with sudo ./openvpn-install.sh and not sudo sh ./openvpn-install.sh as read command has issues with external triggering of scripts
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS
# This script will work on Debian, Ubuntu, CentOS and probably other distros
# of the same families, although no support is offered for them. It isn't
# bulletproof but it will probably work if you simply want to setup a VPN on
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and
# universal as possible.
@nazt
nazt / DustSensor.ino
Last active August 29, 2015 14:24 — forked from ituchkub/DustSensor.ino
DustSensor.ino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <WiFiHelper.h>
#include <CMDust.h>
const char* ssid = "";
const char* pass = "";
int pinDust = 14;
float concentrations = 0;