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 / 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;
@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 / 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 / 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 / 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 / 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;
#!/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.
/*
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]
*/
@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;
#!/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'