it tweets

This commit is contained in:
2017-03-18 16:19:48 +01:00
parent 41c52e75a2
commit 63071086e9
11 changed files with 26 additions and 10 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
config.py
*.pyc
死ぬ.png

BIN
examples/4/out23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
examples/4/out24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

BIN
examples/4/out25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 KiB

BIN
examples/4/out26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

BIN
examples/4/out27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

BIN
examples/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

BIN
examples/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 KiB

View File

@@ -3,8 +3,8 @@
(setf *random-state* (make-random-state t)) (setf *random-state* (make-random-state t))
(defvar *file* "out~a.png") (defvar *file* "死ぬ.png")
(defvar *size* 1000) (defvar *size* (+ 500 (random 2000)))
(defmacro rand () `(random 1.0)) (defmacro rand () `(random 1.0))
@@ -13,20 +13,20 @@
(defun main () (defun main ()
(let* ((mid (* *size* .5)) (let* ((mid (* *size* .5))
(repeat (random 25)) (repeat (random 10))
(offset (random 100))
(grains (random 10)) (grains (random 10))
(itt (random 2000)) (itt (random 2000))
(bg (rand-rgba 1.0)) (bg (rand-rgba 1.0))
(active (rand-rgba 0.6)) (active (rand-rgba 0.6))
(sand (sandpaint* *size* :active active :bg bg))) (sand (sandpaint* *size* :active active :bg bg)))
(loop for i in (linspace 100 900 repeat) (loop for i in (linspace 100 (- *size* 100) repeat)
for j from (- repeat 5) to repeat do for j from offset to (+ offset repeat) do
(format t "~a/~a (~a)~%" j repeat (* 1.0 (/ j repeat)))
(let ((snk (snek*)) (let ((snk (snek*))
(va (list 0 0)) (va (list 0 0))
(vb (list 0 0)) (vb (list 0 0))
(p1 (list 100 i)) (p1 (list (random 100) i))
(p2 (list 900 i))) (p2 (list (random (- *size* 100)) i)))
(loop for k from 1 to itt do (loop for k from 1 to itt do
(let ((v1 (insert-vert (l-on-line k itt p1 p2) into snk)) (let ((v1 (insert-vert (l-on-line k itt p1 p2) into snk))
@@ -41,7 +41,8 @@
(join-verts v1 v2)) (join-verts v1 v2))
(sandpaint-edges sand snk grains) (sandpaint-edges sand snk grains)
(sandpaint-verts sand snk) (sandpaint-verts sand snk)))))
(sandpaint-save sand (format nil *file* j))))))))
(sandpaint-save sand *file*)))
(main) (main)

10
tweet.py Normal file
View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
import twitter
import config
api = twitter.Api(consumer_key=config.consumer_key,
consumer_secret=config.consumer_secret,
access_token_key=config.access_token_key,
access_token_secret=config.access_token_secret)
api.PostUpdate("", media=u"死ぬ.png")

2
update.sh Executable file
View File

@@ -0,0 +1,2 @@
sbcl --script shinu.lisp
python tweet.py