Demonstration of a bike whose handlebars turn the opposite direction to the wheel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trivial example adapted from a CodeSkulptor example: | |
# http://www.codeskulptor.org/#user39_dAIPAbXbfU_0.py | |
from Tkinter import Button, E, Entry, Frame, Label, StringVar, Tk, W | |
class Application(Frame): | |
def get_initials(self): | |
initials = (self.first_name.get()[:1].upper() + | |
self.last_name.get()[:1].upper()) | |
print "Initials:", initials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
p = subprocess.Popen(['ping', '-c', '10', 'google.com'], stdout=subprocess.PIPE) | |
print 'Started.' | |
use_iterator = False | |
if use_iterator: | |
# This is buffered, so waits for several pings. | |
for line in p.stdout: | |
print line, |
Sample text for Pinyin Cushion.
你好。我得去。
你好。我得{dei3}去。
木匠老趙是個老實人,快四十歲了還沒結婚。他能做桌子,椅子,床,櫃子,也常常幫人修理門窗。手藝雖然不是很精細,做出來的東西卻很結實,很牢固。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from subprocess import check_output, CalledProcessError | |
from logging import getLogger, basicConfig, INFO | |
logger = getLogger('main') | |
def report_progress(message='Progress', progress=0, limit=None): | |
try: | |
process_ids = list(map( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Queue import Empty, Queue | |
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, Namespace | |
from glob import glob | |
import os | |
from itertools import count | |
from threading import Thread | |
from time import sleep | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import ceil | |
from matplotlib import pyplot as plt | |
plot_count = 8 | |
column_count = 2 | |
row_count = int(ceil(plot_count/column_count)) | |
fig, subplot_axes = plt.subplots(row_count, | |
column_count, | |
squeeze=False, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
from matplotlib import pyplot as plt | |
import pandas as pd | |
import requests | |
import seaborn as sn | |
DATA_PATH = Path('data') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t=dict(r='<rect x="{}" y="{}" width="{}" height="{}" fill="{}"/>',p='<path d="{}" stroke="{}" stroke-width="{}" stroke-dasharray="{}" fill-rule="{}" fill="{}"/>',c='<circle cx="{}" cy="{}" r="{}" fill="{}"/>') | |
s=(ord(input()[0])|32)-97 | |
open('a.svg','w').write(f'<svg xmlns="http://www.w3.org/2000/svg" width="60" height="40">{"".join(t[o[0]].format(*(o[1:].split(":")))for o in"r0:0:30:40:#fff;pM 60,0 H 30 V 40 H 60 L 40,20:0:0:0::#003298|pM 60,0 H 0 V 40 H 60 L 40,20:0:0:0::#f00|r0:0:60:40:#039;r0:8:60:24:#fff;r0:16:60:8:#f00|r0:0:60:40:#fbfc01;r0:13.3:60:13.3:#003298|r0:0:60:20:#039;r0:20:60:20:#f00|r0:0:60:40:#fff;pM 30,0 L 0,20 L 30,40 L 60,20:0:0:0::#f00|r0:0:60:40:#ff0;r10:0:10:40:#039;r30:0:10:40:#039;r50:0:10:40:#039|r0:0:30:40:#fff;r30:0:30:40:#f00|r0:0:60:40:#ff0;c30:20:10.7:#000|r0:0:60:40:#039;r0:13.3:60:13.3:#fff|r0:0:30:40:#ff0;r30:0:30:40:#039|pM0,0H60V40H0:0:0:0::#FF0;pM0,20H60V0H30V40H0:0:0:0::#0|r0:0:60:40:#039;pM 0,0 L 60,40 M 0,40 L 60,0:#fff:10:0::#0|r0:0:60:40:#039;pM 0,0 H 60 V 10 H 0 z M |