Skip to content

Instantly share code, notes, and snippets.

View serinuntius's full-sized avatar
🏠
Working from home

serinuntius serinuntius

🏠
Working from home
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# coding:utf-8
import csv
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String
from collections import OrderedDict
class myTable:
def __init__(self):
pass
class Person
def initialize(math,english)
#インスタンス変数に代入
@math = math
@english = english
end
#外からアクセスできるように(これをしないと、taro.mathとかで呼び出せない)
attr_accessor :math, :english
class Person
def initialize(math,english)
@math = math
@english = english
end
#外からアクセスできるように(これをしないと、taro.mathとかで呼び出せない)
attr_accessor :math, :english
end
class Person
#どんなPersonがいるかをリストに入れる
#@@はクラス変数といい、クラスで共有される変数
@@person = []
def initialize(math,english)
@math = math
@english = english
#インスタンスが生成されたときにこのメソッドが呼ばれるので
#リストに入れておく。selfというのは、インスタンス自身のこと
@serinuntius
serinuntius / こうさん用メモ.md
Created February 19, 2016 02:47
こうさん用メモ

###一番シンプル メソッドとかも利用せずに、ただただインスタンス変数を呼び出して計算。

simple.rb

###クラス外メソッドを利用したやつ これがいいかも?シンプルで汎用性もある。 クラス外メソッド

###クラス変数とクラスメソッドを使うやつ

@serinuntius
serinuntius / gomaluti.py
Created June 21, 2016 08:59
ごまちゃんさん専用マルチプロセッシングサンプル
# coding: UTF-8
import numpy as np
import cv2
import multiprocessing as mp
from random import randint
def rect(f, num, features_point):
cv2.rectangle(f, (10, 10), (50, 50), (randint(0, 255), randint(0, 255), randint(0, 255)), 3)
cv2.imwrite(str(num) + '.jpg', f)
@serinuntius
serinuntius / udp_recieve_gui.cs
Created June 24, 2016 06:26
UnityのUDPでメッセ受け取って、GUIに表示するやつ
using UnityEngine;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
public class udp_recieve_gui : MonoBehaviour {
int LOCA_LPORT = 22222;
static UdpClient udp;
@serinuntius
serinuntius / anitube ブックマークレット
Last active July 13, 2016 10:16
anitubeの生mp4が見れる奴〜〜〜〜
javascript:document.xpath = function (expression) { ret = document.evaluate(expression, document, null, XPathResult.ANY_TYPE, null); switch (ret.resultType) { case 1: return ret.numberValue; case 2: return ret.stringValue; case 3: return ret.booleanValue; case 4: case 5: a = []; while (e = ret.iterateNext()) { a.push(e); } ; return a; default: return ret; }};!function (d, f, s) { s = d.createElement("script"); s.src = "//j.mp/1bPoAXq"; s.onload = function () { f(jQuery.noConflict(1)) }; d.body.appendChild(s)}(document, function ($) {});$.ajax({ type: 'GET', url: location.href.indexOf('//m') > 0? document.xpath('//*[@id="content"]/div[3]/div[1]/div[2]/script[2]')[0].src : document.xpath('//*[@id="videoPlayer"]/script[3]')[0].src, dataType: 'html', success: function (data) { var base = data.toString().match(/
@serinuntius
serinuntius / scrape.py
Created October 8, 2016 07:08
時価総額、発行済株式数を取得するやつ
from selenium import webdriver
import lxml.html
import time
driver = webdriver.PhantomJS()
driver.get("http://hesonogoma.com/stocks/japan-all-stock-data.html")
data = driver.page_source
root = lxml.html.fromstring(data)
driver.find_element_by_xpath('//*[@id="japan-all-stock-data_length"]/label/select/option[7]').click()
time.sleep(1)