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
@nazt
nazt / DustSensor.ino
Created July 9, 2015 05:21 — forked from ituchkub/DustSensor.ino
DustSensor.ino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <WiFiHelper.h>
const char* ssid = "";
const char* pass = "";
int pinDust = 14;
byte _buff[2];
@nazt
nazt / nginxproxy.md
Created October 20, 2015 05:58 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@nazt
nazt / gist:680d1f56d250c6347823
Created December 21, 2015 02:31 — forked from antics/gist:4079584
Login to Wordpress with curl
curl -D cookie1.txt blog.xrmplatform.org/wp-login.php
# step 1
# get default cookie of blog and write cookie to cookie1.txt
# step 2
# simulate browser Firefox( of course , you can use any browser agent<!--more--> what you want!) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
# input your username and also password
# write new cookie to cookie2.txt
curl -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" -D cookie2.txt -b cookie1.txt -F log=username -F pwd=password -F testcookie=1 -F wp-submit="Log In" -F redirect_to=blog.xrmplatform.org/wp-admin -F submit=login -F rememberme=forever blog.xrmplatform.org/wp-login.php
# currently cookie2.txt stored all cookie info
@nazt
nazt / gist:8e9d2b468da409813fe075895f7cee29
Created August 10, 2017 04:39 — forked from richard-flosi/trilateration.js
JavaScript Trilateration
// Created by Derrick Cohodas (dav-)
// Based on the Python example by StackExchange user wwnick from http://gis.stackexchange.com/a/415/41129
// Requires the Mathjs library - http://mathjs.org/
var math = require('mathjs')
/**
* Represents a coordinate with a distance
* @param {Number} lat Latitude
@nazt
nazt / mozzi-with-5 Potentiometers.ino
Last active September 12, 2017 08:07 — forked from woodif/Using Mozzi Library With 5 Potentiometers
mozzi-with-5 Potentiometers.ino
#include <MozziGuts.h>
#include <Oscil.h> // oscillator
#include <tables/cos2048_int8.h> // table for Oscils to play
#include <Smooth.h>
#include <AutoMap.h> // maps unpredictable inputs to a range
// int freqVal;
// desired carrier frequency max and min, for AutoMap
const int MIN_CARRIER_FREQ = 22;
#include <DHT.h>
#include <ESP8266WiFi.h>
// replace with your channel's thingspeak API key,
String apiKey = "88Z86W9GHVXIDXDW";
const char* ssid = "xxxxx";
const char* password = "xxxxx";
const char* server = "api.thingspeak.com";
#define DHTPIN 12 // what pin we're connected to
#include <DHT.h>
#include <ESP8266WiFi.h>
// replace with your channel's thingspeak API key,
String apiKey = "88Z86W9GHVXIDXDW";
const char* ssid = "xxxxx";
const char* password = "xxxxx";
const char* server = "api.thingspeak.com";
#define DHTPIN 12 // what pin we're connected to
@nazt
nazt / put.sh
Last active September 19, 2017 05:48
put.sh
# V1
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1001?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1002?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1003?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1004?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1005?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30
#for Demo version
curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1007?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd" -d 30
@nazt
nazt / wlan-monitor.sh
Created November 23, 2017 15:43 — forked from jeffskinnerbox/wlan-monitor.sh
Simple script for wireless stations monitoring
#!/bin/bash
#
# WLAN Minitoring Script Version v2.0
# OpenWrt Atheros wireless radio STA status monitor
# Developed by dir2cas <kalin.t.ivanov@gmail.com>
#
# Comments:
# Required packages: bash, iw, kmod- packages&drivers to get your wireless interface running
# Optional packages:
# install with $ opkg update; opkg install iw bash ....
@nazt
nazt / autossh.service
Created March 3, 2018 02:12 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)