Skip to content

Instantly share code, notes, and snippets.

@mmmulani
Created March 20, 2013 00:05
Show Gist options
  • Save mmmulani/5201287 to your computer and use it in GitHub Desktop.
Save mmmulani/5201287 to your computer and use it in GitHub Desktop.
Move terminal in a circle
#!/usr/bin/python -u
import math
import time
x_start = 400
y_start = 500
# 100 = 1 full rotation
TICKS = 500
# Measured in pixels.
SIZE = 100
for i in range(0, TICKS):
x = math.sin(i * math.pi * 2 / 100.0)
y = math.cos(i * math.pi * 2 / 100.0)
x_coord = int(x_start + (SIZE * x))
y_coord = int(y_start - (SIZE * y))
print "\033[3;{0};{1}t\033[1D".format(x_coord, y_coord),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment