This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
ip='90.185.22.1' | |
url='http://ipinfo.io/%s/loc'%ip | |
request = requests.get(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int servo_minimum = 0; | |
static int servo_maximum = 180; | |
static unsigned int filter_alpha = 10; | |
#include <Servo.h> | |
Servo finger1, finger2, finger3, finger4, finger5; | |
int servoPin1 = 5; | |
int servoPin2 = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Power{ | |
public static void main(String[] args) | |
{ | |
Power runner = new Power(); | |
int x = Integer.parseInt(args[0]); | |
int n = Integer.parseInt(args[1]); | |
System.out.println(runner.F(x,n)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class BinomialApplet extends JApplet { | |
//init the two binomial algorithms: | |
private Binomial1 algo1 = new Binomial1(); | |
private Binomial2 algo2 = new Binomial2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#define GYRO_ADDRESS ((int) 0x68) // 0x68 = 0xD0 / 2 | |
// Arduino backward compatibility macros | |
#if ARDUINO >= 100 | |
#define WIRE_SEND(b) Wire.write((byte) b) | |
#define WIRE_RECEIVE() Wire.read() | |
#else | |
#define WIRE_SEND(b) Wire.send(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arrays to save our results in | |
unsigned long start_time; | |
unsigned long stop_time; | |
unsigned int dX; | |
unsigned int dY; | |
unsigned int lastX; | |
unsigned int lastY; | |
unsigned int currentX; | |
unsigned int currentY; | |
unsigned int filterAlpha=16; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This code runs on an ESP8266 wifi module, compiled/programmed through the Arduino IDE. | |
The specific hardware in this case is a NodeMCU v0.9 module | |
The ESP hosts a webserver on port 80, with event listeners for access on / , /unlock, and /buzzToggle, | |
it also listens on UPD port 1337 for the (newline terminated) string "SESAME" | |
it broadcasts itself as "door" on Mdns, so that devices on LAN can access it via http://door.local (unless it's an android device, because fuck that.) | |
Hand coded http response and body are in the handleroot() function. | |
Door unlock and buzzer toggle is physically handled with solidstate relays, so all this code needs to do is toggle I/O pins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <ESP8266WebServer.h> | |
#include <ESP8266mDNS.h> | |
//Function declarations: | |
void handleRoot(); | |
void handleToggle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This sketch sends data via HTTP GET requests to $host. | |
* | |
* Magic numbers are used to determine which line(s) to handle, and which part of this line is used. | |
* The numbers are determined using curl (or some other http dump program) | |
*/ | |
#if defined(ESP8266) | |
#pragma message "ESP8266 stuff happening!" | |
#include <ESP8266WiFi.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//exponentialFilter.ino | |
//example sketch to pull and filter measurements from eg. an ADC | |
//the filter has a beta value which determines the weight of new values. | |
//A high beta value will filter more noise but slow down the response of the filter. | |
static float filterBeta=32; //1, 2 , 4, 8, 16, 32, 64, 128 and so on... | |
//where is the data coming from? | |
static unsigned int adcPin=A0; | |
//the filtered value for printing or whatever: |
OlderNewer