Skip to content

Instantly share code, notes, and snippets.

@NaotoKumagai
NaotoKumagai / ohuro_kanshi.ino
Last active February 26, 2021 02:08
シェアハウスのお風呂利用状況監視君
#include <Arduino.h>
#include <Hash.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
#include <WebSocketsClient.h>
#include <ArduinoJson.h>
extern "C" {
#include "user_interface.h"
@NaotoKumagai
NaotoKumagai / sample.java
Created December 20, 2016 03:42
day9:int[]を逆順で出力する
IntStream.of(arr)
.boxed()
.collect(Collectors.toCollection(LinkedList::new))
.descendingIterator()
.forEachRemaining(i -> System.out.print(i + " "));
@NaotoKumagai
NaotoKumagai / sample.java
Created December 20, 2016 03:43
day10:2進変換して"1"が続く最大数の出力
import java.io.*;
import java.util.*;
import java.util.stream.Stream;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.close();
@NaotoKumagai
NaotoKumagai / sample.java
Created December 22, 2016 04:15
Day 11: 2D Arrays
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
@NaotoKumagai
NaotoKumagai / sample.java
Created December 22, 2016 05:48
Day 12: Inheritance
class Student extends Person{
private int[] testScores;
Student(String firstName, String lastName, int id, int[] testScores) {
super(firstName, lastName,id);
this.testScores = testScores;
}
public String calculate() {
double avarage = java.util.stream.IntStream.of(testScores)
@NaotoKumagai
NaotoKumagai / sample.java
Created December 24, 2016 03:10
Day 14: Scope
// Add your code here
Difference(int[] elements) {
this.elements = elements;
}
public void computeDifference() {
for(int i =0; i< elements.length; i++) {
for(int j=0; j < elements.length; j++) {
int difference = Math.abs(elements[i] - elements[j]);
if(difference > maximumDifference) {
@NaotoKumagai
NaotoKumagai / sample.java
Created December 24, 2016 04:00
Day 15: Linked List
public static Node insert(Node head,int data) {
//Complete this method
if(head==null) {
return new Node(data);
}
head.next = insert(head.next, data);
return head;
}
@NaotoKumagai
NaotoKumagai / index.js
Created May 16, 2017 14:29
Get RSS on Cloud Function
exports.helloWorld = function helloWorld(req, res) {
var FeedParser = require('feedparser');
var request = require('request');
var feed = '====RSS_URL===';
var req2 = request(feed);
var feedparser = new FeedParser({});
var items = [];
var titles = '';