Skip to content

Instantly share code, notes, and snippets.

Ando takuya-andou

View GitHub Profile
@takuya-andou
takuya-andou / ConvertToQR.py
Created Aug 28, 2017
リスト内のURLを一気にQR化するためのスクリプト
View ConvertToQR.py
# -*- coding: utf-8 -*-
import sys
import qrcode
# QRコードを作る場合
URLarray = ['http://google.com','http://yahoo.co.jp']
for i, URL in enumerate(URLarray):
img = qrcode.make(URL) # ''内の文字をQRコードに変換
img.save('qr_img' + str(i) + '.png') # QRコードに名前をつけて保存
@takuya-andou
takuya-andou / GoogleShortener.py
Created Aug 28, 2017
リスト内のURLを一気に短縮化するためのスクリプト
View GoogleShortener.py
# coding:utf-8
import sys
import re
from urllib2 import urlopen as U, Request as R
from json import loads as J
API_KEY = "ここはGoogleのAPIを取得して使う"
API = "https://www.googleapis.com/urlshortener/v1/url?key=" + API_KEY
View piano.js
const DashButton = require('dash-button');
const {exec} = require('child_process');
const do1 = new DashButton("xx:xx:xx:xx:xx:xx"); //じゃがりこ
const re = new DashButton("xx:xx:xx:xx:xx:xx"); //パンテーン
const mi = new DashButton("xx:xx:xx:xx:xx:xx"); //ヘルシア
const fa = new DashButton("xx:xx:xx:xx:xx:xx"); //カロリーメイト
const so = new DashButton("xx:xx:xx:xx:xx:xx"); //エヴィアン
const ra = new DashButton("xx:xx:xx:xx:xx:xx"); //アマゾンベーシック
const si = new DashButton("xx:xx:xx:xx:xx:xx"); //シーブリーズ
@takuya-andou
takuya-andou / byebyeSteve.py
Created Dec 13, 2016
Amazon Dash Button launches Steve
View byebyeSteve.py
# coding: utf-8
from scapy.all import *
from picraft import World, Vector, Block
world = World("MineCraftServer IP")
def arp_display(pkt):
if pkt[ARP].op == 1:
if pkt[ARP].hwsrc == 'Your AmazonDashButton's Mac Address':
world.player.pos = Vector(0, 300, 0)
@takuya-andou
takuya-andou / LineBotBeaconAPI.php
Created Oct 6, 2016
LineビーコンとLineMessagingAPIによる勤怠管理
View LineBotBeaconAPI.php
<?php
$json_string = file_get_contents('php://input');
$json_object = json_decode($json_string);
$AndoUserID = '<<LineUserID>>';
error_log("callback start.");
foreach ($json_object->events as $event) {
if('message' == $event->type){
if ($event->source->userId == $AndoUserID) {
if ($event->message->text =='おは'){
View classifier_from_little_data_script_3.py
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
View googlenet.py
from scipy.misc import imread, imresize
from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, merge, Reshape, Activation
from keras.models import Model
from keras.regularizers import l2
from keras.optimizers import SGD
from googlenet_custom_layers import PoolHelper,LRN
def create_googlenet(weights_path=None):
@takuya-andou
takuya-andou / file0.txt
Created Jul 6, 2016
Labellioで作った分類器を自前のubuntuで動かそうとした時に出たエラーと解決策 ref: http://qiita.com/takuya-andou/items/20bfacaf21dfec965201
View file0.txt
Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Traceback (most recent call last):
File "app.py", line 8, in <module>
from labellio import Classifier, Config, ImageLoader, Label
File "/usr/local/lib/python2.7/dist-packages/labellio/__init__.py", line 2, in <module>
from labellio.classifier import Classifier
File "/usr/local/lib/python2.7/dist-packages/labellio/classifier.py", line 6, in <module>
from labellio.net import Net
File "/usr/local/lib/python2.7/dist-packages/labellio/net.py", line 4, in <module>
import caffe
@takuya-andou
takuya-andou / file0.txt
Created Jul 5, 2016
angular2でページ読み込み後に処理を実行する方法 ref: http://qiita.com/takuya-andou/items/24f4d5dbd86e102fe231
View file0.txt
import {Component, AfterViewInit} from 'angular2/core';
@Component({
selector: 'home',
templateUrl: './components/home/home.html'
})
export class HomeCmp implements AfterViewInit {
ngAfterViewInit() {
View haiku_input.txt
あきつ湧き宙にとどまる地獄谷
いつきに夏ふと人間が宙にあり
かいつぶり硝子の沓を宙に見す
かはらけの宙とんでゆく二月かな
からくりの唐子宙飛ぶ飛騨の春
かるがるとおんぶばつたの宙をとぶ
かるた取り紫式部宙に舞ふ
くろぐろと富士は宙吊り冬霞
こたへなき雪山宙に労働歌
こと切れしごとく枯蔓宙吊りに
You can’t perform that action at this time.