Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View naoyashiga's full-sized avatar

Naoya naoyashiga

View GitHub Profile
@naoyashiga
naoyashiga / ColorCodes.js
Created May 25, 2023 23:59
Color Codes Game
import React, {useState, useEffect} from "react";
export const ColorCodes = () => {
const [colors, setColors] = useState([]);
const [correctColor, setCorrectColor] = useState("");
const [isCorrect, setIsCorrect] = useState(false);
const [isShowResult, setIsShowResult] = useState(false);
@naoyashiga
naoyashiga / main.py
Created October 23, 2022 00:08
オノマトペ一覧取得
"""
雑です。日本語として成立していないものも出力されます。
5600個くらい出ます。
"""
excludes = 'ぁぃぅぇぉゔゕゖゐゑゎ'
hiragana = [chr(i) for i in range(ord("ぁ"), ord("ゖ")+1) if chr(i) not in excludes]
print("".join(hiragana))
count = 1
for first in hiragana:
@naoyashiga
naoyashiga / create_many_files_on_Mac.sh
Created February 7, 2021 06:59
シェルスクリプトを用いてデスクトップに大量の無害のファイルを生成する。
# 1. デスクトップフォルダに移動
cd ~/Desktop/
# 2. ファイル生成コマンドを実行
for i in {1..200}; do echo "yo" > hack$i.html; done
# 3. 一括ファイル削除
rm hack*.html
@naoyashiga
naoyashiga / k_largest_elements_indices.py
Last active April 28, 2017 08:54
値が大きい上位K件の配列インデックスを取得
#探す対象リスト:my_arrayはnumpy
#例:上位3件
K = 3
# ソートはされていない上位k件のインデックス
unsorted_max_indices = np.argpartition(-my_array, K)[:K]
# 上位k件の値
y = my_array[unsorted_max_indices]
@naoyashiga
naoyashiga / autoencoder_mnist.py
Created March 5, 2017 06:12
AutoEncoder for MNIST
# -*- coding: utf-8 -*-
# Inspired
# [TensorFlow-Examples/autoencoder.py at master · aymericdamien/TensorFlow-Examples](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/autoencoder.py)
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
@naoyashiga
naoyashiga / faceDetect.py
Created January 22, 2017 07:13
python2.7,opencvで顔認識
import cv2
from os import path
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
cascades_dir = path.normpath(path.join(cv2.__file__, '..', '..', '..', '..', 'share', 'OpenCV', 'haarcascades'))
cascade_f = cv2.CascadeClassifier(path.join(cascades_dir, 'haarcascade_frontalface_alt2.xml'))
def faceDetect(filePath):
@naoyashiga
naoyashiga / index.js
Created January 1, 2017 09:24
Facebook Messenger Bot, aws lambdaでおうむ返しbot
const request = require('request');
const PAGE_ACCESS_TOKEN = "";
var options = {
hostname: "graph.facebook.com",
path: "/v2.6/me/messages?access_token=" + PAGE_ACCESS_TOKEN,
method: 'POST',
headers: {
'Content-Type': 'application/json'
@naoyashiga
naoyashiga / writeIkku.rb
Last active December 27, 2016 12:00
一句(五七五)を抽出してテキストに書き出す
require "ikku"
reviewer = Ikku::Reviewer.new
sourceTextFileName = '../data/wiki.txt'
outputTextFileName = 'math.txt'
outputTextFile = File.open(outputTextFileName,'w')
begin
File.open(sourceTextFileName) do |file|
file.each_line do |line|
@naoyashiga
naoyashiga / SpuriousCorrelations.md
Last active October 4, 2016 00:48
Spurious Correlations指標翻訳まとめ

#Ingestibles

指標A 指標B correlation 捕捉
Hot Dog Eating Contentの優勝者のホットドッグ消費量 NY timesベストセラーリストででフィクション作品が1位になった数 91.5
チーズの消費量 ベッドのシーツのもつれ事故 94.7
マーガリンの消費量 メイン州の離婚率 98.9
チキンの消費量 紙とボード製品の消費量 99.6
マクドナルドの顧客満足度 食道を詰まらせる死亡事故件数 85.6
茶の消費量 芝刈り機の誤操作での死亡人数 93
牛肉の消費量 落雷での死亡数 87
@naoyashiga
naoyashiga / kiji.html
Last active August 19, 2016 02:31
kiji.html
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="ja"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="ja"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="ja"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" lang="ja"><!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">