Skip to content

Instantly share code, notes, and snippets.

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++;
import java.util.*;
float len = 20.0;
float deg = 87.5;
void setup()
{
fullScreen();
background(255);
strokeWeight(2);
@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
@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)
#include <Servo.h>
#define SERVO_PIN 3
Servo servo;
void setup() {
Serial.begin(9600);
servo.attach(SERVO_PIN);
servo.write(60);
}
@8q
8q / catfiles.c
Last active October 7, 2018 13:52
uniq < tmp.txt | wc -l
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define MAX_READ 128
@8q
8q / docker-compose.yml
Created July 21, 2018 13:07
for nvcr.io/nvidia/digits
version: '2.3'
services:
digits:
image: nvcr.io/nvidia/digits:18.06
runtime: nvidia
ports:
- "5000:5000"
volumes:
- ./data:/data
- ./jobs:/workspace/jobs
@8q
8q / gas_slack_bot.gs
Created October 7, 2018 12:24
GASによるサーバーの死活監視Slackボット
function isServerAlive() {
var serverUrl = PropertiesService.getScriptProperties().getProperty('SERVER_URL');
var options = {
muteHttpExceptions: true,
};
var res = UrlFetchApp.fetch(serverUrl, options);
return res.getResponseCode() == 200;
}
function postMessage(msg) {
@8q
8q / Main.scala
Created October 26, 2018 18:12
scalaでmapを畳み込みを使って作ってみる
object Main {
def main(args: Array[String]): Unit = {
def map[T, U](ls: List[T])(f: T => U): List[U] = ls.foldRight(Nil: List[U])((x, y) => f(x) :: y)
println(map(List(1, 2, 3))(x => x * 2))
}
@8q
8q / docker-compose.yml
Created November 11, 2018 03:31
mysql立ち上げ
version: '3'
services:
mysql:
image: mysql/mysql-server:5.7
ports:
- "3306:3306"
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_ROOT_HOST=%