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
// Pub Sub On Node.js | |
var awsIot = require('aws-iot-device-sdk'); | |
var device = awsIot.device({ | |
keyPath: 'keys/XXXXX.private.key', | |
certPath: 'keys/XXXXX.cert.pem', | |
caPath: 'keys/aws-iot-rootCA.crt', | |
clientId: 'max-1', | |
host: 'AAAAA.iot.us-east-1.amazonaws.com' |
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
// upload to FlashAir from macosApp via Alamofire | |
import Alamofire | |
class ViewController: NSViewController { | |
@IBAction func GetFileSelectClicked(_ sender: Any) { | |
let file: NSOpenPanel = NSOpenPanel() | |
file.allowsMultipleSelection = false | |
file.canChooseFiles = true | |
file.canCreateDirectories = true |
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
// Alamofire4 / Swift3 multipart data + prams upload | |
Alamofire.upload(multipartFormData:{ multipartFormData in | |
multipartFormData.append(self.imageNSURL, withName: "room[image]") | |
let roomText:String = self.roomName.text! as String | |
let bodyText = self.roomIntroduction.text | |
if let data = roomText.data(using: String.Encoding.utf8) { | |
multipartFormData.append(data, withName: "room[title]") | |
} | |
if let data = bodyText?.data(using: String.Encoding.utf8) { |
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
#coding:utf-8 | |
# http://taizo.hatenablog.jp/entry/2016/06/28/072112 | |
# http://qiita.com/lrf141/items/ff1462c5c6b7b3207775 | |
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture(0) | |
cap.set(3, 640) |
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
1. | |
/etc/module | |
i2c-dev | |
2. | |
/etc/modprobe.d/raspi-blacklist.conf | |
#blacklist i2c-bcm2708 | |
reboot |
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
1.AWS S3 Make Bucket | |
2.AWS S3 Setup User | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "s3:*", | |
"Resource": [ |
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
Doorkeeper.configure do | |
resource_owner_authenticator do |routes| | |
current_user || warden.authenticate!(:scope => :user) | |
end | |
resource_owner_from_credentials do |routes| | |
request.params[:user] = {:email => request.params[:username], :password => request.params[:password]} | |
request.env["devise.allow_params_authentication"] = true | |
request.env["warden"].authenticate!(:scope => :user) | |
end |
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
- (void)orientationChanged:(NSNotification *)notification { | |
NSLog(@"%s", __func__); | |
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; | |
CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame]; | |
float statusBarHeight = (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) ? statusBarViewRect.size.width : statusBarViewRect.size.height; | |
float heightPadding = statusBarHeight + self.navigationController.navigationBar.frame.size.height; | |
[self.tableView setContentInset:UIEdgeInsetsMake(heightPadding, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right)]; | |
} |
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 <SPI.h> | |
#include "ble.h" | |
#include <Wire.h> | |
#include "BlinkM_funcs.h" | |
// blinkM | |
#define blinkm_addr 0x00 |
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 <SPI.h> | |
#include "ble.h" | |
#include <Wire.h> | |
#include "BlinkM_funcs.h" | |
#define blinkm_addr 0x00 | |