Skip to content

Instantly share code, notes, and snippets.

View xhiroga's full-sized avatar

Hiroaki Ogasawara xhiroga

View GitHub Profile
@xhiroga
xhiroga / getPopTeamEpic2.py
Created April 1, 2017 15:21
scrapyでポプテピピックセカンドシーズンの更新をスクレイピングしたいときのためのコードです。
# -*- coding: utf-8 -*-
import scrapy
import re
import boto3
from pptp.items import PptpItem
class Popute2Spider(scrapy.Spider):
name = "popute2"
allowed_domains = ["mangalifewin.takeshobo.co.jp/rensai/popute2/"]
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
def main():
print (type(mnist)) # これ何型?
x = tf.placeholder(tf.float32, [None, 784])
@xhiroga
xhiroga / selniumClinkEnter_nasa.py
Created April 15, 2017 06:08
(第75回)Python mini Hack-a-thonの成果物! #pyhack
#!python
#-*-coding:utf-8-*-
# before run this source,
# 1. pip install selenium
# 2. npm install -g phantomjs
from selenium import webdriver
from selenium.webdriver.common.keys import Keys as keys
import time
@xhiroga
xhiroga / b2016.py
Created April 15, 2017 08:20
use selenium to click button. acquire full website.
# -*- coding: utf-8 -*-
import scrapy
class B2016Spider(scrapy.Spider):
name = "b2016"
allowed_domains = ["http://2016.spaceappschallenge.org/challenges/earth/sea-ice-app/projects"]
start_urls = ['http://2016.spaceappschallenge.org/challenges/earth/sea-ice-app/projects/']
# 要するにdef process_requestという名前でresponseを返すクラスが登録されていればいいのだろうか
@xhiroga
xhiroga / gist:85ddd4ed0d1de6131d87dce6573a83cc
Created August 16, 2017 06:39
はてなブログでソースコードっぽい記載になるやつ
<pre class="code" data-lang="c#" data-unlink="">
void Update () {
Animator anim = GetComponent<animator> ();
AnimatorStateInfo state = anim.GetCurrentAnimatorStateInfo (0);<br />
if (Input.GetKeyDown (KeyCode.Space)) {
anim.SetTrigger ("Jump");
}<br />}
</pre>
@xhiroga
xhiroga / contact_form_sample.html
Created September 30, 2017 06:53
Pingendoで作ってみたページ
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
<link rel="stylesheet" href="https://pingendo.com/assets/bootstrap/bootstrap-4.0.0-beta.1.css" type="text/css"> </head>
<body>
@xhiroga
xhiroga / .vimrc
Last active January 23, 2018 13:19
さわらの.vimrc
" 作者:
" @hiroga_cc
""""""一般""""""
set history=500
"set autoread
"ex mode遷移を無効化
nnoremap Q <Nop>
@xhiroga
xhiroga / app.py
Last active October 2, 2017 23:07
PRG Pattern sample for me
import tornado.ioloop
import tornado.web
from jinja2 import Environment, FileSystemLoader
class MainHandler(tornado.web.RequestHandler):
def get(self):
env = Environment(loader=FileSystemLoader('./', encoding='utf8'))
template = env.get_template('./login.html')
self.write(template.render())
@xhiroga
xhiroga / script.js
Created November 15, 2017 14:12
script for Napstablook camera effect
const D = require('Diagnostics');
const Scene = require('Scene')
const TouchGestures = require('TouchGestures');
const heart = Scene.root.find('heart');
TouchGestures.onTap().subscribe((e) => {
heart.hidden = false;
});
@xhiroga
xhiroga / Fib.java
Created November 28, 2017 22:30
シングルスレッドで再帰的にフィボナッチ数列を計算するプログラム
public class Fib {
public static int fib(int n){
if (n == 0){
return 0;
} else if(n == 1){
return 1;
} else {
return fib(n-1) + fib(n-2);
}