Skip to content

Instantly share code, notes, and snippets.

Yuiki Yuiki

Block or report user

Report or block Yuiki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Yuiki
Yuiki / Main.java
Last active Aug 29, 2015
縦書き俳句プログラミング in Semicolonless Java.
View Main.java
/*
* Title:縦書き俳句プログラミング in Semicolonless Java.
* Description:初めてのSemicolonless Java。
* Author:ゆいき @_yuiki
*/
public class Main {
public static void main(String[] args) {
for (String haiku : new String[]{"古池や 蛙飛び込む 水の音"}) {
for (String[] splitHaiku : new String[][]{haiku.split(" ")}) {
@Yuiki
Yuiki / Main.java
Created Jul 4, 2015
等差数列の和を求める。
View Main.java
public class Main {
private static class ArithmeticProgression {
private final int a, n, d;
ArithmeticProgression(int a, int n, int d) {
this.a = a;
this.n = n;
this.d = d;
}
@Yuiki
Yuiki / Main.java
Created Jul 12, 2015
ArrayList処理と配列処理の実行時間の比較。
View Main.java
public class Main {
private final int quantity = 1000000;
// frequencyの値を増やすほど精度が増す。
private final int frequency = 10;
// コンストラクタで要素数指定。
private final List<Integer> list = new ArrayList<>(quantity);
private final int[] array = new int[quantity];
public static void main(String[] args) {
Main main = new Main();
@Yuiki
Yuiki / get_followers_website.rb
Last active Mar 25, 2016
Killed by rate limit.
View get_followers_website.rb
require "twitter"
client = Twitter::REST::Client.new do |config|
config.consumer_key = "hoge"
config.consumer_secret = "fuga"
config.access_token = "piyo"
config.access_token_secret = "moge"
end
File.open("website.txt", "w") do |file|
@Yuiki
Yuiki / tweetbot.py
Last active Dec 21, 2016
Twitter botサンプル
View tweetbot.py
# -*- coding: utf-8 -*-
import tweepy
import ConfigParser
import random
import locale
import datetime
import pytz
import urllib2
import re
from xml.etree import ElementTree
@Yuiki
Yuiki / rename.rb
Created Dec 23, 2016
一括リネーム
View rename.rb
require 'fileutils'
require 'date'
if ARGV.size < 2
STDERR.print "Usage: ruby #{$0} <path> <name>\n"
exit(1)
end
PATH = ARGV[0].gsub(File::ALT_SEPARATOR) {File::SEPARATOR}
NAME = ARGV[1]
View Timer.java
class Timer {
private long startNanoTime, endNanoTime = 0L;
void start() {
this.startNanoTime = System.nanoTime();
}
void stop() {
if (startNanoTime != 0L) {
this.endNanoTime = System.nanoTime();
View PrimeFactorization.java
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
class PrimeFactorization {
private final String dividend;
PrimeFactorization(String dividend) {
this.dividend = dividend;
}
@Yuiki
Yuiki / tsukuba_rent_checker.py
Last active Dec 7, 2017
使い捨てコードのため、殴り書き
View tsukuba_rent_checker.py
from bs4 import BeautifulSoup
import requests
import unicodedata
url = "https://tsukuba-daigaku.com/?bukken=jsearch&shu=2&kalc=0&kahc=0&mad%5B%5D=110&mad%5B%5D=120&tik=0&cor=0"
districts = {}
count = 0
for i in range(0, 40):
request = requests.get(url)
soup = BeautifulSoup(request.text, "html.parser")
@Yuiki
Yuiki / gen_java_class_by_json.py
Last active Sep 26, 2017
JSON形式のAPIレスポンスからJavaクラスを生成(書き殴り)
View gen_java_class_by_json.py
import json
class JavaClass:
def __init__(self, name):
self.name = name
self.fields = dict()
def add_field(self, java_type, name):
self.fields[name] = java_type
You can’t perform that action at this time.