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
| """ | |
| Rounded rectangles for PyGame in both non-antialiased and antialiased varieties. 2019 edition... now with anti-aliased alpha support! | |
| """ | |
| import pygame | |
| import pygame as pg | |
| from pygame import gfxdraw | |
| from collections import abc | |
| def round_rect(surface, rect, color, rad=20, border=0, inside=(0,0,0,0)): |
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 simple proxy server. Usage: | |
| http://hostname:port/p/(URL to be proxied, minus protocol) | |
| For example: | |
| http://localhost:8080/p/www.google.com | |
| """ |
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
| javascript:(function(){var links = [ | |
| "https://en.wikipedia.org/wiki/Special:Random", | |
| "https://en.wikipedia.org/wiki/Portal:Current_events", | |
| "http://mathworld.wolfram.com/", | |
| "http://functions.wolfram.com/", | |
| "https://en.wikipedia.org/wiki/Portal:Contents/Outlines", | |
| "https://en.wikipedia.org/wiki/Glossary_of_areas_of_mathematics", | |
| "http://mathworld.wolfram.com/classroom/", | |
| "https://en.wikipedia.org/wiki/Lists_of_mathematics_topics", | |
| "https://en.wikipedia.org/wiki/Mathematics_Subject_Classification#First-level_areas", |
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
| ''' Read and parse SVG files returning a shapely GeometryCollection containing the paths and primitives found. | |
| Transforms are applied and all shapes are returned in the SVG root elements coordinate space. Primitives (rect, | |
| circle and ellipse) are converted to equivalent paths, and only shape outlines are rendered, stroke properties | |
| have no affect and are discarded. | |
| Curved paths (arc and bezier commands and rounded rect, ellipse and circle elements) are linearized using a | |
| naive approach that attempts to create enough segments to reduce maximum distance to the curve to below a | |
| certain threshold, although this is probably not very efficient and most likely implemented in a fairly | |
| broken way.''' |
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
| ''' This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as | |
| high-quality audio-only streams from Youtube Music, which are protected by a "signatureCipher" obfuscation scheme. | |
| To use it, first install [ytmusicapi] and [pytube] using pip, then follow the instructions for creating the auth | |
| file from the response in an authenticated session to a watch-page request as found in your browser's dev-tools. | |
| The downloaded files are placed in ~/Music, named with the artist and track metadata, and will be skipped instead | |
| of downloaded again next time it is run, based on the videoIds of the downloaded songs. | |
| Merry Xmas - V. |
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 very basic k-means/elbow clustering | |
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
| # "wrote this up one day while sitting on the terlet. i do some of my best | |
| # thinking there" - Author - Victor M. Condino - Wednesday, Feb. 3rd, 2020 | |
| # | |
| # this is some code to find the optimal clustering of points in a n-dimensional | |
| # dataset, when the number of clusters is not known uses the elbow-method. | |
| # | |
| # (I'd like to dedicate this to my mom, Martha, who knows way more about |
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
| /** | |
| * Interpolates a Catmull-Rom Spline through a series of x/y points | |
| * Converts the CR Spline to Cubic Beziers for use with SVG items | |
| * | |
| * If 'alpha' is 0.5 then the 'Centripetal' variant is used | |
| * If 'alpha' is 1 then the 'Chordal' variant is used | |
| * | |
| * | |
| * @param {Array} data - Array of points, each point in object literal holding x/y values | |
| * @return {String} d - SVG string with cubic bezier curves representing the Catmull-Rom Spline |
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
| #!/usr/bin/python3 | |
| ''' | |
| reindent.py | |
| this script is a tool for fixing inconsistent indentation when your chosen editor chooses to hose your tabs with a bunch of spaces | |
| ''' | |
| import os, sys, argparse | |
| from io import StringIO |
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 function that will apply a function to each argument | |
| #include <initializer_list> | |
| #include <utility> | |
| template <typename F, typename... Ts> | |
| void for_each_arg(F&& f, Ts&&... ts) | |
| { | |
| using I = std::initializer_list<int>; | |
| (void) I { (std::forward<F>(f)(std::forward<Ts>(ts)), 0)... }; |