Skip to content

Instantly share code, notes, and snippets.

View anoochit's full-sized avatar

Anuchit Chalothorn anoochit

View GitHub Profile
@anoochit
anoochit / hello.service
Created September 23, 2014 05:06
node.js systemd unit file
[Unit]
Description=Hello Express Service
After=mongod.service
[Service]
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=node-hello
Environment=NODE_ENV=production
@anoochit
anoochit / example.py
Created September 28, 2014 15:29
example file for ds18b20 python module
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import sleep
from ds18b20 import DS18B20
def main():
sensor = DS18B20()
while True:
@anoochit
anoochit / button.py
Last active August 29, 2015 14:07
raspberry pi button and led with gpio
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17,GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(27,GPIO.OUT)
GPIO.output(27,GPIO.LOW)
@anoochit
anoochit / index.html
Last active August 29, 2015 14:07
polymer tutorial step 01
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title Page</title>
<script src="components/bower_components/platform/platform.js"></script>
<link rel="import" href="components/bower_components/paper-elements/paper-elements.html">
<link rel="import" href="components/bower_components/core-toolbar/core-toolbar.html">
@anoochit
anoochit / index.html
Last active August 29, 2015 14:07
polymer tutorial step 02
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title Page</title>
<script src="components/bower_components/platform/platform.js"></script>
<link rel="import" href="components/bower_components/paper-elements/paper-elements.html">
<link rel="import" href="components/bower_components/core-toolbar/core-toolbar.html">
@anoochit
anoochit / ardudroid-mortor
Created October 19, 2014 03:38
ardudroid and motor controller
#define START_CMD_CHAR '*'
#define END_CMD_CHAR '#'
#define DIV_CMD_CHAR '|'
#define CMD_DIGITALWRITE 10
#define CMD_ANALOGWRITE 11
#define CMD_TEXT 12
#define CMD_READ_ARDUDROID 13
#define MAX_COMMAND 20 // max command number code. used for error checking.
#define MIN_COMMAND 10 // minimum command number code. used for error checking.
#define IN_STRING_LENGHT 40
@anoochit
anoochit / Main.java
Created October 19, 2014 03:52
joystick controller + bluetooth spp library for arduino robot
public void setup() {
textView1 = (TextView) findViewById(R.id.textView1);
textView2 = (TextView) findViewById(R.id.textView2);
textView3 = (TextView) findViewById(R.id.textView3);
textView4 = (TextView) findViewById(R.id.textView4);
textView5 = (TextView) findViewById(R.id.textView5);
layout_joystick = (RelativeLayout) findViewById(R.id.layout_joystick);
@anoochit
anoochit / node-red-blink.js
Created November 2, 2014 05:01
node-red-blink
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
#include "DHT.h"
// Update these with values suitable for your network.
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
byte server[] = { 192, 168, 0, 104 };
byte ip[] = { 192, 168, 0, 105 };
@anoochit
anoochit / Dockerfile
Created November 26, 2014 15:31
fig sample dockerfile
FROM orchardup/python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt