Skip to content

Instantly share code, notes, and snippets.

#include <Servo.h>
#define SERVO_PIN 3
Servo servo;
void setup() {
Serial.begin(9600);
servo.attach(SERVO_PIN);
servo.write(60);
}
@8q
8q / yakudo.py
Created June 25, 2018 15:08
mis1yakudo
import numpy as np
import cv2
orig = cv2.imread('src.png').astype(np.float32)
width, height, _ = orig.shape
center_x, center_y = width/4, height/2
blur, iterations = 0.008, 20
map_x1 = np.fromfunction(lambda y, x: x, (width, height), dtype=np.float32)
map_y1 = np.fromfunction(lambda y, x: y, (width, height), dtype=np.float32)
@8q
8q / lineimage.py
Created June 22, 2018 07:02
写真を白黒の線画風の画像にする
# 写真を白黒の線画風の画像にするプログラム
# orig/*.jpg を読み込んで output/*.jpg として出力する
# http://tadaoyamaoka.hatenablog.com/entry/2017/02/19/172744
# http://gori-naru.blogspot.com/2012/11/blog-post_8647.html
import os
import shutil
import glob
import cv2
from tqdm import tqdm
import java.util.*;
float len = 20.0;
float deg = 87.5;
void setup()
{
fullScreen();
background(255);
strokeWeight(2);
function getSheet(name) {
return SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name);
}
function getEndRow(sheet, col) {
var endRow = 0;
var lastRow = sheet.getLastRow()
for(var i = 1; i <= lastRow; i++) {
if(sheet.getRange(i, col).getValue() === "") break;
endRow++;
@8q
8q / Dockerfile
Last active May 21, 2018 08:00
Dockerfile(python + jupyter+ tf + keras) from https://github.com/ufoym/deepo
# MIT License
# Copyright (c) 2017 Ming
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@8q
8q / copy.gs
Created May 17, 2018 06:43
トリガーで値の変更に設定しておく
function onChange(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('シート1');
var endRow = 0;
for(var i = 1; i <= ss.getLastRow(); i++) {
if(ss.getRange(i, 2).getValue() == "") break;
endRow++;
}
ss.getRange(endRow, 3).setValue(ss.getRange(endRow, 2).getValue())
}
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer player;
FFT fft;
@8q
8q / genetic_algorithm.pde
Created April 8, 2018 15:33
mischan.png[83x100], takagiya.png[80x80]
import java.util.List;
import java.util.Iterator;
import java.util.Arrays;
Stage stage;
Population population;
int LIFE_TIME = 400;
float MUTATION_RATE = 0.025;
int POPULATION_NUM = 20;
name: "AnimeFace"
layer {
name: "train-data"
type: "Data"
top: "data"
top: "label"
data_param {
batch_size: 30
}