Skip to content

Instantly share code, notes, and snippets.

View zephiransas's full-sized avatar

Takafumi Yoshida zephiransas

View GitHub Profile
public static void test1() {
int sum = 0;
for(int i = 1;i < 1000;i++) {
if(i % 3 == 0 || i % 5 == 0) sum+= i;
}
System.out.println(sum);
}
public class Problem2 {
public static void main(String... args) {
List<Integer> data = new ArrayList<>();
int ix = 0;
while (true) {
ix++;
int v = fib(ix);
if(v > 4_000_000) break;
data.add(v);
}
public class Problem1 {
public static void main(String... args) {
int value = Streams.intRange(1, 1000).filter(i -> i % 3 == 0 || i % 5 == 0).sum();
System.out.println(value);
}
}
require 'rubygems'
require 'roo'
book = Roo::Excelx.new("/Users/zephiransas/Desktop/Book1.xlsx")
book.default_sheet = book.sheets.first
p "--------------"
p book.cell(1, 'A')
p book.cell(1, 'B')
p "--------------"
@zephiransas
zephiransas / gist:4192308
Created December 3, 2012 02:54
.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "sqale"]
url = ssh://sqale@gateway.sqale.jp:2222/zephiransas/test.git
fetch = +refs/heads/*:refs/remotes/sqale/*
SELECT * FROM shops WHERE
(
SELECT management_division_value
FROM shop_management_divisions
WHERE management_division_id = 7 AND shop_management_divisions.shop_id = shops.id
) = 1 AND
(
SELECT management_division_value
FROM shop_management_divisions
WHERE management_division_id = 8 AND shop_management_divisions.shop_id = shops.id
@zephiransas
zephiransas / gist:2640912
Created May 9, 2012 01:10
substringByte
public static String substringByte(String str, int length) {
int len = 0;
StringBuffer buff = new StringBuffer();
if(str == null) return null;
for(int i = 0;i < str.length();i++) {
if(str.charAt(i) <= 0x7f) {
@zephiransas
zephiransas / common_followers.rb
Created May 2, 2012 13:54 — forked from yusuke/common_followers.rb
print user ids of common followers
require "net/http"
def get_ids(screen_name)
url = "http://api.twitter.com/1/followers/ids.json?screen_name=" + screen_name
ids_response = Net::HTTP.get_response(URI.parse(url)).body
/\[(.*)\]/.match(ids_response)[1].split(",").map { |x| x.to_i }.sort
end
id1_followers = get_ids(ARGV.shift)
id2_followers = get_ids(ARGV.shift)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sun.glassfish</string>
<key>Disabled</key>
<false/>
<!--
@zephiransas
zephiransas / .gitignore
Created December 28, 2011 01:26
Websocket Test
.classpath
.project
.settings/*
target