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
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;
}
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();
@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]
@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 / 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 / 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 / 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
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(" ")}) {
You can’t perform that action at this time.