Skip to content

Instantly share code, notes, and snippets.

View yusuke's full-sized avatar

Yusuke Yamamoto yusuke

View GitHub Profile
package twitter4j;
import java.util.stream.IntStream;
public class Cpu {
public static void main(String[] args) throws TwitterException {
Twitter twitter = TwitterFactory.getSingleton();
IntStream.range('a', 'Z'+1).forEach(e-> {
try {
twitter.updateStatus(String.format("@syobochim %sカップ", (char) e));
package order;
import twitter4j.HttpClient;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created with IntelliJ IDEA.
* User: yusuke
@yusuke
yusuke / gist:a00646e8bfaa9092c3c1
Last active August 29, 2015 14:05
ボリュームをリモートでコントロールするjsp
<%@ page language="java" contentType="text/html; charset=UTF-8" session="false"%><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>online volume controller</title>
</head>
<body><%request.setCharacterEncoding("UTF-8");
String volume = request.getParameter("volume");
try{
int volumeInt = Integer.parseInt(volume);
volumeInt = volumeInt < 0 ? 0 : volumeInt;
/*
Copyright 2013 Yusuke Yamamoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@yusuke
yusuke / gist:4803f7924d6052873cc9
Created August 1, 2014 16:07
記念 8/2 01:07
01:06 ~ $ telnet www.facebook.com 80
Trying 31.13.79.49...
Connected to star.c10r.facebook.com.
Escape character is '^]'.
GET /index.html HTTP/1.0
HTTP/1.1 503 No server is available for the request
Content-Type: text/html; charset=utf-8
Date: Fri, 01 Aug 2014 16:07:06 GMT
Connection: close
@yusuke
yusuke / pom.xml
Created July 2, 2014 11:40
ほら!
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
public class A {
public static void main(String[] args) throws IOException, URISyntaxException {
String content = String.join("\n",Files.readAllLines(Paths.get(A.class.getResource("/a.properties").toURI()), Charset.defaultCharset()));
System.out.println(content);
import twitter4j.Twitter;
import twitter4j.TwitterFactory;
public class 改行テスト {
public static void main(String[] args) throws Exception{
Twitter t = TwitterFactory.getSingleton();
t.updateStatus("Hello\nworld");
}
/*
* Copyright 2007 Yusuke Yamamoto
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright 2007 Yusuke Yamamoto
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software