Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>webgpu-test</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
#! /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 April 4, 2017 14:24
「れたその場所は、まるで天国のようだった。憎しみ悲しみもなく、ただ暖かいひだまりのような場所。でも、そこに入る許しは得られるんだろうか?原罪すら持てない、人形の」 <9Sのハードウェアメモリに残っていた最後の記録から>
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import binascii
if __name__ == '__main__' :
s = 'e3808ce3828ce3819fe3819de381aee5a0b4e68' + \
'980e381afe38081e381bee3828be381a7e5a4a9' + \
#! /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 February 14, 2017 15:55
solve tower of hanoi
#! /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
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 November 4, 2016 13:09
sleep with JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Web Worker 99</title>
</head>
<body>
<script type="text/javascript">
@shogonir
shogonir / SysEnv.scala
Created November 1, 2016 14:56
Read environmental variable with 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 October 18, 2016 16:06
check data dog-agent is running
package process
import scala.sys.process._
/**
* Created by shogo on 2016/10/19.
*/
object ProcessSample {
def main(args: Array[String]) {
package process
import scala.sys.process._
/**
* Created by shogo on 2016/10/19.
*/
object ProcessSample {
def main(args: Array[String]) {