Skip to content

Instantly share code, notes, and snippets.

View ryuichimatsumoto-single's full-sized avatar

Ryuichi Matsumoto ryuichimatsumoto-single

View GitHub Profile
import csv
from selenium import webdriver
driver = webdriver.Chrome("c:/chromedriver.exe")
driver.get("https://www.mercari.com/jp/search/?keyword=XXXXXX")
# Excelで読み込めるようにSJISで保存
f = open('C:\\Users\\matsumoto\\Documents\\result.csv', 'w',encoding='CP932', errors='replace')
# csvファイルを定義
@ryuichimatsumoto-single
ryuichimatsumoto-single / makeHistgram.sql
Created September 9, 2017 12:28
Make histgram from SQL for servey sales stetement
select (@number := 0 ) AS min, (@number := @number + 200) AS max,count(*) as cnt,sum(AAA) as sum from WWW where XXX IN (YY,YY) and AAA between 0 and 200 and BBB between "2017-07-20 00:00:00" and "2017-08-17 23:59:59"
UNION select (@number := 200 ) AS min, (@number := @number + 200) AS max,count(*) as cnt,sum(AAA) as sum from WWW where XXX IN (YY,YY) and AAA between 201 and 400 and BBB between "2017-07-20 00:00:00" and "2017-08-17 23:59:59"
UNION select (@number := 400 ) AS min, (@number := @number + 200) AS max,count(*) as cnt,sum(AAA) as sum from WWW where XXX IN (YY,YY) and AAA between 401 and 600 and BBB between "2017-07-20 00:00:00" and "2017-08-17 23:59:59"
UNION select (@number := 600 ) AS min, (@number := @number + 200) AS max,count(*) as cnt,sum(AAA) as sum from WWW where XXX IN (YY,YY) and AAA between 601 and 800 and BBB between "2017-07-20 00:00:00" and "2017-08-17 23:59:59"
UNION select (@number := 800 ) AS min, (@number := @number + 200) AS max,count(*) as cnt,sum(AAA) as sum from WWW wh
@ryuichimatsumoto-single
ryuichimatsumoto-single / practice_table.sql
Created December 23, 2016 08:45
1ヶ月おきの累計売上高をMySQLで集計し、Excelでグラフにする ref: http://qiita.com/ryuichi69/items/ba0858c3af977adff418
CREATE TABLE IF NOT EXISTS `tbl` (
`id` int(10) NOT NULL COMMENT '主キー',
`time` datetime NOT NULL COMMENT '集計日',
`sales` int(100) NOT NULL COMMENT 'その日の売上高'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#include<stdio.h>
int main()
{
int x;
int y;
int z;
int p;
int start = 1;
int end = 10;
int count = 0;
#include<stdio.h>
int main()
{
int a;
int b;
int p;
int start = 1;
int end = 50;
int count = 0;
for(a=start;a<end;a++)
#include<stdio.h>
int main()
{
int x = 0;
int y = 0;
int count = 0;
for(x=-100;x<101;x++)
{
for(y=-100;y<101;y++)
{
#include<stdio.h>
long int is_prime(long int n)
{
int bool = 0;//nが素数かどうかの判定
if(n > 1)
{
long int count = 0;//2からnまで走査し、割り切れたものをカウント
for(long int k=1;k<(n+1);k++)
@ryuichimatsumoto-single
ryuichimatsumoto-single / calc.sql
Last active April 9, 2016 00:23
一度に平均、標準偏差を計算するSQL文
SELECT count(*),sum(column),avg(column),stddev(column),max(column),min(column) FROM table_name WHERE <statement>
@ryuichimatsumoto-single
ryuichimatsumoto-single / adams_servey.c
Created March 13, 2016 11:19
アダムズ方式(2)
#include<stdio.h>
#include<math.h>
#define NUM 47
#define CHAR_PREFECTURE_MAX 256
#define MAX_SEAT 295
//配列の合計の値を出力
int sum(double a[])
{
int i=0;
int result = 0;
@ryuichimatsumoto-single
ryuichimatsumoto-single / adams.c
Last active March 11, 2016 23:59
アダムズ方式
#include<stdio.h>
#include<math.h>
#define NUM 2
//配列の合計の値を出力
int sum(double a[])
{
int i=0;
int result = 0;
for(i=0;i<NUM;i++)
{