Skip to content

Instantly share code, notes, and snippets.

View Taywee's full-sized avatar

Taylor C. Richberger Taywee

View GitHub Profile
@Taywee
Taywee / tipples.py
Created May 17, 2016 20:20
Fix tipples
#!/usr/bin/env python3
import argparse
import random
import string
import sys
import textwrap
import yaml
r = lambda: random.randint(0,255)
@Taywee
Taywee / tipples.yml
Created May 17, 2016 20:21
Tipples yml
Politicians:
Lyndon B. Johnson: Scotch & Soda
Queen Elizabeth II: Gin & Dubonet
Richard Nixon: [Rum & Coke, Gin Martini]
Margaret Thatcher: Whiskey & Soda
Gerald Ford: Gin & Tonic
Napoleon Bonaparte: Absinthe
Barack Obama: Beer
Winston Churchill: Whiskey
Musicians:
@Taywee
Taywee / tipples.dot
Created May 17, 2016 20:22
tipples dotfile
digraph Tipples {
label = "Famous\nTipples";
subgraph cluster_film {
label = "Film";
color = "#7E795D";
humphreybogart [label = "Humphrey\nBogart"];
georgelucas [label = "George\nLucas"];
johntravolta [label = "John\nTravolta"];
marilynmonroe [label = "Marilyn\nMonroe"];
jenniferaniston [label = "Jennifer\nAniston"];
@Taywee
Taywee / genas400pass.py
Last active November 29, 2016 03:12
Generate AS400 password. MIT License
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2016 Taylor C. Richberger <taywee@gmx.com>
# This code is released under the license described in the LICENSE file
import argparse
import random
import string
STARTSPECIAL = '$@#'
@Taywee
Taywee / mutt_octet_lookup.py
Created December 6, 2016 01:12
CC0: A simple script that is used to load up the mailcap file and look up and call the appropriate program, for use when a filetype (especially pdf) is incorrectly given an application/octet-stream type
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# To the extent possible under law, Taylor C. Richberger has waived all
# copyright and related or neighboring rights to mutt_octet_lookup. This work
# is published from: United States.
import argparse
import locale
import mailcap
import mimetypes
@Taywee
Taywee / splittable.py
Last active February 8, 2017 20:08
A very simple python function that will split apart a textual table into rows and columns (use six to replace range and zip if you need good performance in python 2). Public Domain (CC0)
# To the extent possible under law, Taylor C. Richberger has waived all copyright and related or neighboring rights to splittable. This work is published from: United States.
def splittable(table):
'''An incredibly simple routine to split a textual table based on "gutters"
in it. Only works on a line-by-line basis, so any tables with multi-line
rows will not work. It also needs a solid verticle whitespace gutter
between lines. Does not work with tabs. If you have a table with tabs, it
will need to be preexpanded before being passed in. Does not strip, so if
you need cells to be stripped, it will have to be done after this
function. The columns can only span to the shortest line, so empty columns
@Taywee
Taywee / 325e.cxx
Last active August 7, 2017 06:48
daily programming 325 Easy
/* 325 Easy - Color Maze
Written in 2017 by Taylor C. Richberger
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along
with this software. If not, see
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
@Taywee
Taywee / 325e-ncurses.cxx
Created August 8, 2017 17:09
Same 325 Easy solution, but with an extra-fancy ncurses mode
/* 325 Easy - Color Maze
Written in 2017 by Taylor C. Richberger
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along
with this software. If not, see
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
@Taywee
Taywee / 345h.rb
Created January 4, 2018 17:49
Daily Programming Challenge 345 Hard: 2D Triangle Mesh Generator (MIT License)
#!/usr/bin/env ruby
# Copyright 2018 Taylor C. Richberger
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@Taywee
Taywee / 348h.rb
Last active January 28, 2018 06:12
Implementation of daily programming challenge 348 Hard. Not a useable solution, because it fails to complete the challenge in an appropriate time
#!/usr/bin/env ruby
# Copyright © 2018 Taylor C. Richberger <taywee@gmx.com>
# This code is released under the MIT license
require 'set'
def square?(number)
Math.sqrt(number).round ** 2 == number
end