Skip to content

Instantly share code, notes, and snippets.

View naoki-sawada's full-sized avatar
🍮

Naoki Sawada naoki-sawada

🍮
View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import serial
import math
def makeSendData(val):
print val
if val >= 100:
h = int(math.floor(val/100))
import MeCab
text = 'けものフレンズのサーバルちゃん可愛い'
tagger_options = [
'-d /usr/local/lib/mecab/dic/mecab-ipadic-neologd',
'--eos-format=''',
# '--node-format=%f[8]',
]
@naoki-sawada
naoki-sawada / rename.py
Last active August 8, 2017 02:51
replace the file name.
import os
from shutil import copyfile
from pathlib import Path
SOURCE_PATH = '.'
DEST_PATH = './re'
d_path = Path(DEST_PATH)
if not d_path.is_dir():
os.makedirs(DEST_PATH)
# -*- coding: utf-8 -*-
import re
import serial
port = '/dev/cu.usbserial-DN0129J0'
baud = 115200
ser = serial.Serial(port, baud, stopbits=serial.STOPBITS_ONE, parity=serial.PARITY_NONE)
while True:
[alias]
graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
ignore = !"f() { local s=$1; shift; \
while [ $# -gt 0 ]; do s=\"$s,$1\"; shift; done;\
curl \"https://www.gitignore.io/api/$s\"; }; f"
@naoki-sawada
naoki-sawada / bash_profile
Last active September 27, 2017 01:17
bash_profile
#######################
# Path settings
#######################
export PATH=$HOME/anaconda/bin:$PATH
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
#######################
# Bash settings
#######################
import cv2
import numpy as np
from keras.applications.mobilenet import MobileNet
from keras.preprocessing import image
from keras.applications.mobilenet import preprocess_input, decode_predictions
IMG_SIZE = 224
IMG_NAME = 'photo.jpg'
model = MobileNet(weights='imagenet')
#!/bin/bash
curl "http://webapi.aitalk.jp/webapi/v2/ttsget.php" \
-o "$1.wav" \
-d "text=$1" \
-d "speaker_name=nozomi" \
-d "ext=wav" \
-d "username={YOUR_API_USER_NAME}" \
-d "password={YOUR_API_PASSWORD}" \
@naoki-sawada
naoki-sawada / mqtt-example.md
Last active April 29, 2018 00:57
Mqtt demo code

Mqtt Example

About

This is the example code of mqtt.

@naoki-sawada
naoki-sawada / docker-compose.yml
Created July 8, 2018 10:12
docker-compose example
version: '3'
services:
db:
restart: always
image: mysql:5.7.22
container_name: myservice_db
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
volumes:
- ./db/myservice/var/lib/mysql:/var/lib/mysql
- ./db/myservice/init:/docker-entrypoint-initdb.d