Skip to content

Instantly share code, notes, and snippets.

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

Hiroyuki Tachibana hiroism007

🏠
Working from home
View GitHub Profile
@hiroism007
hiroism007 / BubbleSort.java
Created April 23, 2013 14:40
バブルソート
/**
* Created with IntelliJ IDEA.
* User: hiroism007
* Date: 4/23/13
* Time: 11:17 PM
* To change this template use File | Settings | File Templates.
*/
public class BubbleSort {
static int[]testNumbers;
public static void main(String[] args){
@hiroism007
hiroism007 / Eratosthenes.java
Created April 21, 2013 08:41
new eratosthenes written in Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
/**
* Created with IntelliJ IDEA.
* User: 橘博之
* Date: 4/20/13
@hiroism007
hiroism007 / eratosthenes.rb
Created April 20, 2013 11:45
エラトステネスのふるい
puts "素数リストを作成します。数えたい最大の数を入れてください\n"
max_number = gets.to_i
primes = {}
for i in 2..max_number do primes[i] =true end
for i in 2..max_number do
(2*i).step(max_number,i){|n| primes[n] = false } if primes[i]==true
end
p primes.delete_if{|k,v| v == false}.keys
@hiroism007
hiroism007 / Eratosthenes.java
Created April 20, 2013 09:09
エラトステネスのふるい
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
/**
* Created with IntelliJ IDEA.
* User: 橘博之
* Date: 4/20/13
@hiroism007
hiroism007 / carrierwave.rb
Last active December 15, 2015 15:09
amazonS3 + fog + carrierwave, fileupload setting.
CarrierWave.configure do |config|
config.fog_credentials =
:provider => 'AWS',
:aws_access_key_id => ENV["AWS_S3_KEY_ID"],
:aws_secret_access_key => ENV["AWS_S3_SECRET_KEY"]
}
config.fog_directory = ENV["AWS_S3_BUCKET"]
end
@hiroism007
hiroism007 / backup.rb
Last active December 15, 2015 10:08
Ruby script for mac os, that backups minecraft save data wherever you want to put. Modify save_path wherever you like to save data. Default backup path is set Documents/backup direcotry.
require 'fileutils'
#path to your minecraft save data.Ordinary minecraft's save data is game_path directory, but if you change your minecraft data to another place, change the game_path.
game_path = "/Users/YOUR_ACCOUNT_NAME/Library/Application\ Support/minecraft/saves"
#path to your directory where you want to save your minecraft save data.
save_path = "/Users/YOUR_ACCOUNT_NAME/Documents/backup/"
#make a folder named as daytime by Time.now method and copy save data files in that folder.
FileUtils.cp_r(game_path, save_path + Time.now.to_s)