This file contains hidden or 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 pygame | |
| pygame.init() | |
| pygame.display.set_mode((500, 400), 0, 32) | |
| while True: | |
| for event in pygame.event.get(): | |
| print(event) |
This file contains hidden or 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
| #circle.py | |
| import pygame | |
| def draw_outlined_circle2(surf, color, origin, radius, thickness): | |
| width = radius * 2 + thickness * 2 | |
| background = (0, 0, 0, 0) | |
| circle = pygame.Surface((width, width)).convert_alpha() | |
| rect = circle.get_rect() | |
| circle.fill(background) | |
| pygame.draw.circle(circle, color, rect.center, radius) |
This file contains hidden or 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 pygame | |
| def draw_outlined_circle2(surf, color, origin, radius, thickness): | |
| width = radius * 2 + thickness * 2 | |
| background = (0, 0, 0, 0) | |
| circle = pygame.Surface((width, width)).convert_alpha() | |
| rect = circle.get_rect() | |
| circle.fill(background) | |
| pygame.draw.circle(circle, color, rect.center, radius) | |
| pygame.draw.circle(circle, background, rect.center, radius - thickness) |
This file contains hidden or 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
| """A tool for saving files to and from a postgresql db. | |
| """ | |
| import os | |
| import sys | |
| import argparse | |
| import psycopg2 | |
| db_conn_str = "postgresql://username:password@localhost:5432/dbname" | |
| create_table_stm = """ | |
| CREATE TABLE files ( |
This file contains hidden or 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
| ''' | |
| How to download and cut up the video (requires python3 and ffmpeg) | |
| virtualenv-3.4 anenv | |
| . ./anenv/bin/activate | |
| pip3.4 install you-get | |
| you-get https://vimeo.com/45878034 | |
| ffmpeg -i View\ from\ the\ ISS\ at\ Night\ from\ Knate\ Myers\ on\ Vimeo.mp4 -ss 00:02:36 -t 00:00:10 -c copy source-video.mp4 |
This file contains hidden or 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
| # closures in python | |
| def f0(x): | |
| closed_var = x + 1 | |
| def fclose(): | |
| return closed_var | |
| return fclose | |
| a_closure = f0(9) | |
| # the 'closed_var' is now x + 1 == 10 |
NewerOlder