Skip to content

Instantly share code, notes, and snippets.

View ryoco's full-sized avatar

YAMASHITA (KATO), Ryoko ryoco

View GitHub Profile
@ryoco
ryoco / ircconnect.py
Created December 8, 2011 17:19
only join irc ,write a message and leave
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, string
import codecs, sys
SERVER = sys.argv[1]
PORT = int(sys.argv[2])
PASS = sys.argv[3]
@ryoco
ryoco / HttpConnectionSample
Created December 15, 2011 08:53
test httpconnection java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
public class HttpConnectionSample
{
@ryoco
ryoco / FizzBuzz.scala
Created January 7, 2012 12:51
scala practice
object FizzBuzz{
def main(args: Array[String]){
val numbers:List[Int] = 1 to 100 toList
val results:List[String] = numbers.map(s =>
if(s % 15 == 0) "FuzzBuzz"
else if(s % 3 == 0) "Fuzz"
else if(s % 5 == 0) "Buzz"
else s.toString
)
println( results )
@ryoco
ryoco / result
Created January 27, 2012 12:56
stack List
よりいい方法があったら誰かエロイ人教えてください
@ryoco
ryoco / sort access log
Created March 12, 2012 12:52
sort access log
lv hoge.txt| grep -o "\w*Page"| sort | uniq -c
@ryoco
ryoco / UserAgent for Chrome
Created March 23, 2012 07:28
UserAgent for Chrome
Android
google-chrome -user-agent="Mozilla/5.0 (Linux; U; Android 1.5; ja-jp; HT-03A Build/CDB72)"
iPhone
google-chrome -user-agent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"
@ryoco
ryoco / add
Created August 8, 2012 13:32
Scala rec test
scala> def selectTailRec(items : List[Int], removeIrems : List[Int], removeItem : Int, roop: int) : (List[Int], List[Int]) = {
| if(roop > 0) { val newList = items.filter(i => i != removeItem)
| selectTailRec(newList, removeItem :: removeIrems, newList.head, roop -1)}
| else (items, removeIrems) }
warning: there were deprecation warnings; re-run with -deprecation for details
selectTailRec: (List[Int],List[Int],Int,int)(List[Int], List[Int])
scala> selectTailRec(List(1,2,3,4,5,6,7,8), Nil, 7, 3)
res2: (List[Int], List[Int]) = (List(3, 4, 5, 6, 8),List(2, 1, 7))
@ryoco
ryoco / use ConstructingParser
Created November 15, 2012 12:54
Unparsed test
import scala.xml.parsing._
import scala.xml._
import scala.io._
val src = Source.fromString("<html><head /><body><script>var foo = \"fooooooo\";</script></body></html>")
val cpa = ConstructingParser.fromSource(src, false);
val doc = cpa.document();
val ppr = new scala.xml.PrettyPrinter(80,2);
val ele = doc.docElem;
val out = ppr.format(ele);
@ryoco
ryoco / shell script
Created November 19, 2012 14:03
rename(replace) filenames
for filename in `ls FOO_*.html`; do newname=`echo $filename | sed -e 's/FOO/BAR/g'`; mv $filename $newname; done
@ryoco
ryoco / base
Created November 21, 2012 07:17
rotation animation
<html>
<head>
<style type="text/css" rel="stylesheet">
#root{
width:480px;
height:480px;
overflow:hidden;
position:relative;
margin: 0 auto;
}