Skip to content

Instantly share code, notes, and snippets.

View wildan3105's full-sized avatar
⌨️
Typing things remotely

Wildan S. Nahar wildan3105

⌨️
Typing things remotely
View GitHub Profile
#define FCY 8000000UL // FCY = FOSC / 2
#include <xc.h>
#include <stdio.h>
#include <libpic30.h>
#include <p30F2020.h>
#include "config.h"
int main(void)
{
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 }; // RESERVED MAC ADDRESS
EthernetClient client;
long previousMillis = 0;
unsigned long currentMillis = 0;
long interval = 3000; // READING INTERVAL
float p = 0.00;
app.post('/results', function(req, res){
var post = {}
post.date = new Date(),
post.temp = req.body.temp
sql.query('INSERT INTO analog_read SET ?', post, function(err, results, fields){
if(err) throw err;
console.log('sent success with value : ', post.temp)
res.json({'status':'success!'})
})
#define FCY 8000000UL // FCY = FOSC / 2
#include <xc.h>
#include <stdio.h>
#include <libpic30.h>
#include <config.h>
int main(void)
{
int channel1Result;
// FBS
#pragma config BWRP = BWRP_OFF // Boot Segment Write Protect (Boot Segment may be written)
#pragma config BSS = NO_BOOT_CODE // Boot Segment Program Flash Code Protection (No Boot Segment)
// FGS
#pragma config GWRP = GWRP_OFF // General Code Segment Write Protect (General Segment may be written)
#pragma config GSS = GSS_OFF // General Segment Code Protection (Disabled)
// FOSCSEL
#pragma config FNOSC = PRIOSC // Oscillator Mode (Primary Oscillator (HS, EC))
/*
* File: newmain.c
* Author: Wildan S. Nahar
*
* Created on April 27, 2017, 7:01 PM
*/
#define FCY 16000000UL
#include <xc.h>
@wildan3105
wildan3105 / .estlintrc.json
Last active September 16, 2017 11:56
Airbnb-inspired eslintrc configuration
{
"extends": "eslint:recommended",
"env": {
"es6":true,
"browser": true,
"node": true
},
"rules": {
"arrow-body-style":"error",
"array-bracket-spacing":"error",
const byte adcPin = 0; // A0
const int MAX_RESULTS = 256;
volatile int results [MAX_RESULTS];
volatile int resultNumber;
// ADC complete ISR
ISR (ADC_vect)
{
if (resultNumber >= MAX_RESULTS)
ADCSRA = 0; // turn off ADC
@wildan3105
wildan3105 / gist:29cf27a01c50a5c0cb6c9c7daf7f6c2b
Created April 11, 2018 03:06 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@wildan3105
wildan3105 / schema.js
Created June 23, 2018 06:23
MongoDB schema
var mongoose = require('mongoose')
var Schema = mongoose.Schema
var lecturerSchema = new Schema ({
name: String,
username: String,
kk: String,
kk_initial: String,
img_url: String,