Skip to content

Instantly share code, notes, and snippets.

Shogo N shogonir

Block or report user

Report or block shogonir

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 PolylinePolygonizer.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import math
from PIL import Image
class Point :
def __init__ (self, x, y) :
@shogonir
shogonir / niercode.py
Created Apr 4, 2017
「れたその場所は、まるで天国のようだった。憎しみ悲しみもなく、ただ暖かいひだまりのような場所。でも、そこに入る許しは得られるんだろうか?原罪すら持てない、人形の」 <9Sのハードウェアメモリに残っていた最後の記録から>
View niercode.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import binascii
if __name__ == '__main__' :
s = 'e3808ce3828ce3819fe3819de381aee5a0b4e68' + \
'980e381afe38081e381bee3828be381a7e5a4a9' + \
View hanoi.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
def display_towers(towers):
for i in range(3):
tower_string = ', '.join(['{0:2d}'.format(num) for num in towers[i]])
print 'tower {0} | {1}'.format(i, tower_string)
print
@shogonir
shogonir / hanoi.py
Created Feb 14, 2017
solve tower of hanoi
View hanoi.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
def display_towers(towers):
for i in range(3):
tower_string = ', '.join(['{0:2d}'.format(num) for num in towers[i]])
print 'tower {0} | {1}'.format(i, tower_string)
print
View drawLine.py
def drawLine (point1, point2) :
points = []
try :
slope = 1.0 * (point2.y - point1.y) / (point2.x - point1.x)
if abs(slope) > 1.0 :
top, bottom = (point1, point2) if point1.y > point2.y else (point2, point1)
for y in range(bottom.y, top.y + 1) :
progress = 1.0 * (y - bottom.y) / (top.y - bottom.y)
x = int(bottom.x + progress * (top.x - bottom.x))
points.append(Vector2(x, y))
@shogonir
shogonir / sleep.html
Created Nov 4, 2016
sleep with JavaScript
View sleep.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Web Worker 99</title>
</head>
<body>
<script type="text/javascript">
@shogonir
shogonir / SysEnv.scala
Created Nov 1, 2016
Read environmental variable with Scala.
View SysEnv.scala
object SysEnv {
def main(args: Array[String]) {
sys.env.getOrElse("USER", "default") match {
case value: String =>
println(value)
case _ =>
println("not string")
}
}
@shogonir
shogonir / ProcessSample2.scala
Created Oct 18, 2016
check data dog-agent is running
View ProcessSample2.scala
package process
import scala.sys.process._
/**
* Created by shogo on 2016/10/19.
*/
object ProcessSample {
def main(args: Array[String]) {
View ProcessSample.scala
package process
import scala.sys.process._
/**
* Created by shogo on 2016/10/19.
*/
object ProcessSample {
def main(args: Array[String]) {
@shogonir
shogonir / SelfSample
Created Oct 3, 2016
Self type sample code implemented with Scala.
View SelfSample
package SelfSample
/**
* Created by shogo on 2016/10/03.
*/
trait MiddleValue {
def middle (list: List[Double]): Double
}
You can’t perform that action at this time.