diff --git a/config/config.yaml b/config/config.yaml index 359c6f3..2a41945 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -42,7 +42,7 @@ social_links: # Full URL to your social link URL: 'https://github.com/jessebot' # can be any glyph in nerdfonts - icon: 'nf-fa-github_alt' + icon: 'nf-fa-github_alt_link' gitlab: URL: 'https://gitlab.com/jessebot' icon: "nf-fa-gitlab" diff --git a/config/example_apache_vhost.conf b/config/example_apache_vhost.conf deleted file mode 100644 index 23f8928..0000000 --- a/config/example_apache_vhost.conf +++ /dev/null @@ -1,50 +0,0 @@ - - ServerName example.com - ServerAdmin example_user@gmail.com - WSGIDaemonProcess example_process_name user=example_user group=example_group processes=1 threads=5 - WSGIScriptAlias / /path/to/web/root/adapter.wsgi - - - WSGIProcessGroup example_group - WSGIApplicationGroup %{GLOBAL} - # comment out next two lines if getting "forbidden" errors - Order deny,allow - Allow from all - # uncomment if getting "forbidden" errors - # Require all granted - - - -# If you need want an SSL, which I recommend, then delete the above content -# and use the below as your starting point. You can use -# https://letsencrypt.org/howitworks/ to get a free SSL. Thanks, EFF <3 - - ServerName example.com - # rewriting things to force https traffic - RewriteEngine on - RewriteCond %{HTTPS} off - RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} - - - ServerName example.com - ServerAdmin example_user@gmail.com - # ssl stuff, you can change these paths to where ever you keep your own SSL files - SSLEngine on - SSLProtocol all -SSLv2 -SSLv3 - SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem - SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem - # wsgi stuff - WSGIDaemonProcess example_process_name user=example_user group=example_group processes=1 threads=5 - WSGIScriptAlias / /path/to/web/root/adapter.wsgi - - - WSGIProcessGroup example_group - WSGIApplicationGroup %{GLOBAL} - # comment out next two lines if getting "forbidden" errors - Order deny,allow - Allow from all - # uncomment if getting "forbidden" errors - # Require all granted - - diff --git a/personal_routes.py b/personal_routes.py new file mode 100755 index 0000000..963dce1 --- /dev/null +++ b/personal_routes.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3.10 +# JesseBot@Linux.com +# last update 2022-10-07 17:06:07.0 +0200 +from flask import Flask +from flask import render_template +import logging as log +import sys +import yaml + +# set logging +log.basicConfig(stream=sys.stderr, level=log.INFO) +log.info("logging config loaded") +# flask app init +app = Flask(__name__, static_folder='static') + + +def get_config_variables(): + """ + Gets config.yaml variables from YAML file. Returns dict. + """ + with open('./config/config.yaml', 'r') as yml_file: + doc = yaml.safe_load(yml_file) + return doc + + +def get_ld_variables(ld_var): + """ + Gets global variables from YAML file. Returns dict. + """ + with open('./config/config_likes_dislikes.yaml', 'r') as f: + doc = yaml.load(f) + txt = doc[ld_var] + return txt + + +def sorted_vars(some_dict): + """ + Iterates through a dict and fixes list values to be alphabitized + takes a dict. + """ + for key, value in some_dict.items(): + value.sort() + some_dict[key] = value + return some_dict + + +@app.route('/like') +def love(): + # Grab site specific information - YAML + globals = get_global_variables() + likes = get_ld_variables("likes") + sorted_likes = sorted_vars(likes) + return render_template('like', config_vars=config_vars, likes=sorted_likes) + + +@app.route('/dislike') +def hate(): + # Grab site specific information - YAML + globals = get_global_variables() + dislikes = get_ld_variables("dislikes") + sorted_dislikes = sorted_vars(dislikes) + return render_template('dislike', config_vars=config_vars, + dislikes=sorted_dislikes) + + +@app.route('/health') +def nutrition(): + # Grab site specific information - YAML + globals = get_global_variables() + return render_template('health', config_vars=config_vars) + + +@app.route('/health/nutrition') +def nutrition(): + # Grab site specific information - YAML + globals = get_global_variables() + return render_template('nutrition', config_vars=config_vars) + + +@app.route('/health/trans') +def trans(): + # Grab site specific information - YAML + globals = get_global_variables() + return render_template('trans', config_vars=config_vars) + + +@app.route('/tech') +def tech(): + # Grab site specific information - YAML + globals = get_global_variables() + return render_template('tech', config_vars=config_vars) + + +@app.route('/resources') +def hate(): + # Grab site specific information - YAML + globals = get_global_variables() + dislikes = get_ld_variables("dislikes") + sorted_dislikes = sorted_vars(dislikes) + return render_template('resources', config_vars=config_vars) diff --git a/scripts/band_names_db.py b/scripts/band_names_db.py deleted file mode 100755 index 18eb610..0000000 --- a/scripts/band_names_db.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# script by jessebot@linux.com to get the bands and do the things -# 1/7/19 -- 2019? D: -import argparse -import subprocess -import sqlite3 - - -def add_new_band(band): - """ - Takes a str of a bands name and adds it to a sqlite3 db - returns the string "Success" if all went well. - """ - # create the band art! - bashCommand = "./generate_band_art.py --band {0}".format(band) - print bashCommand - process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE) - output, error = process.communicate() - print output - - # uh, idunno - return "Success" - - -def get_all_bands(): - """ - grabs all the bands from sqlite3 db - - returns a list of tuples with 2 strings of band_name, and time_stamp - """ - conn = sqlite3.connect('my-next-band.db') - - c = conn.cursor() - - # Insert a row of data - get = '''SELECT * FROM bands''' - c.execute(get) - - # print(c.fetchall()) - all_bands = c.fetchall() - - # close connection - conn.close() - - return all_bands - - -def main(): - """ - Let's get it on! *cracks whip* - """ - parser = argparse.ArgumentParser(description='Document cool band names.') - parser.add_argument('--add-band', dest='band', nargs='?', type=str, - help='a COOL band name') - parser.add_argument('--get-all', dest='get_all', action='store_true', - help='list all cool band names') - - args = parser.parse_args() - - if args.band: - print(add_new_band(args.band)) - - if args.get_all: - print(get_all_bands()) - - -if __name__ == "__main__": - main() diff --git a/scripts/db_init.py b/scripts/db_init.py deleted file mode 100755 index f504b6e..0000000 --- a/scripts/db_init.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# script by jessebot@linux.com to get the bands and do the things -# 1/10/19 -- 2019? D: -import argparse -import sqlite3 -import datetime -import time - -def adapt_datetime(ts): - """ - Internet says I need dis - """ - return time.mktime(ts.timetuple()) - -def main (): - """ - Let's get it on! *cracks whip* - """ - parser = argparse.ArgumentParser(description='Document cool band names.') - parser.add_argument('--band', nargs='?', type=str, - help='a COOL band name') - - args = parser.parse_args() - print((args.band)) - - now = str(datetime.datetime.now()) - - conn = sqlite3.connect('my-next-band.db') - - c = conn.cursor() - - # Create table - c.execute('''CREATE TABLE bands (name text, time text, image text)''') - - # Insert a row of data - insert = '''INSERT INTO bands VALUES ('{0}','{1}','{2}')'''.format(args.band, - now, - "placeholder") - c.execute(insert) - - # Save (commit) the changes - conn.commit() - - # We can also close the connection if we are done with it. - # Just be sure any changes have been committed or they will be lost. - conn.close() - -if __name__ == "__main__": - main() diff --git a/scripts/generate_band_art.py b/scripts/generate_band_art.py deleted file mode 100755 index 3683727..0000000 --- a/scripts/generate_band_art.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 -# script by jessebot@linux.com to get the bands' art and do the things -# 1/10/19 -- 2019? D: -import argparse -import datetime -from google_images_download import google_images_download -import sqlite3 - - -def generate_band_art(band): - # change image results by making different key words - band_list = band.split() - last_item = len(band_list) - 1 - keywd = band_list[last_item] - # google image - response = google_images_download.googleimagesdownload() - absolute_img_paths = response.download({"keywords":keywd, "size":"medium", - "output_directory":"./images/band", - "no_directory":"true", - "no_numbering":"true", "limit":1}) - path = absolute_img_paths[keywd][0] - art = path.replace("/var/www/jessebot.io/images/band/","") - - conn = sqlite3.connect('my-next-band.db') - c = conn.cursor() - - # timestamp! - now = str(datetime.datetime.now()) - - # Insert a row of data - insert = '''INSERT INTO bands VALUES ('{0}','{1}','{2}')'''.format(band, - now, - art) - print(insert) - c.execute(insert) - # Save (commit) the changes - conn.commit() - - # close db connection - conn.close() - - -def main(): - parser = argparse.ArgumentParser(description='Document cool band names.') - parser.add_argument('--band', type=str, nargs='+', help='a COOL band name') - - args = parser.parse_args() - - if args.band: - if type(args.band) == list: - band = " ".join(args.band) - else: - band = args.band - # make art - generate_band_art(band) - -if __name__ == '__main__': - main() diff --git a/scripts/image_processing.py b/scripts/image_processing.py deleted file mode 100644 index 2c9d16a..0000000 --- a/scripts/image_processing.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python3 -import argparse -from PIL import Image -from PIL import ImageFont -from PIL import ImageDraw -import sqlite3 - - -def add_text(): - img = Image.open(image_name) - draw = ImageDraw.Draw(img) - # font = ImageFont.truetype(, ) - font = ImageFont.truetype("sans-serif.ttf", 16) - # draw.text((x, y),"Sample Text",(r,g,b)) - draw.text((0, 0),"Sample Text",(255,255,255),font=font) - img.save('sample-out.jpg') - -def main(): - parser = argparse.ArgumentParser(description='Document cool band names.') - parser.add_argument('--band', type=str, nargs='+', help='a COOL band name') - - args = parser.parse_args() - - if args.band: - if type(args.band) == list: - band = " ".join(args.band) - else: - band = args.band - # make art - generate_band_art(band) - -if __name__ == '__main__': - main() - - - diff --git a/scripts/personal_routes.py b/scripts/personal_routes.py deleted file mode 100755 index 0d3e71d..0000000 --- a/scripts/personal_routes.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/python -# Jesse Hitch - JesseBot@Linux.com -# 1/10/19 Production Web Routing File -- Personal Routes -import bottle -from bottle import redirect, request, response, route -from bottle import run, static_file, template -import logging as log -import os -import sys -import yaml -import band_names_db - - -def get_global_variables(): - """ - Gets global variables from YAML file. Returns dict. - """ - with open('./config/config.yaml', 'r') as f: - doc = yaml.load(f) - txt = doc["Globals"] - return txt - - -def get_ld_variables(ld_var): - """ - Gets global variables from YAML file. Returns dict. - """ - with open('./config/config_likes_dislikes.yaml', 'r') as f: - doc = yaml.load(f) - txt = doc[ld_var] - return txt - - -def sorted_vars(some_dict): - """ - Iterates through a dict and fixes list values to be alphabitized - takes a dict. - """ - for key, value in some_dict.items(): - value.sort() - some_dict[key] = value - return some_dict - - -# Web routes below this line... -# full path to HTML templates -WEB_ROOT = get_global_variables()['web_root'] -bottle.TEMPLATE_PATH.insert(0, '{0}/views/'.format(WEB_ROOT)) - - -@route('/google1ab5c73d1f31729d.html') -def goog(): - # allow google to crawl me harder - return static_file('google1ab5c73d1f31729d.html', root=WEB_ROOT+'/views/') - - -@route('/next-band') -def next_band(): - log.info("oh hi, you must be here to see the name of my next band") - # Grab site specific information - YAML - globals = get_global_variables() - - all_bands = band_names_db.get_all_bands() - log.info("received band.db response: {0}".format(all_bands)) - - return template('next-band', globals=globals, bands=all_bands) - - -@route('/next-band', method='POST') -def next_band_submit(): - # get band from post - inputBand = request.forms.get('inputBand') - log.info("received band name: {0}".format(inputBand)) - - # add new band to db - add_new_band = band_names_db.add_new_band(inputBand) - - # if success redirect back to main page - if add_new_band == "Success": - redirect("/next-band") - else: - return "

THERE WAS AN ERROR: {0}

".format(add_new_band) - - -@route('/love') -def love(): - # Grab site specific information - YAML - globals = get_global_variables() - likes = get_ld_variables("likes") - sorted_likes = sorted_vars(likes) - return template('love', globals=globals, likes=sorted_likes) - - -@route('/hate') -def hate(): - # Grab site specific information - YAML - globals = get_global_variables() - dislikes = get_ld_variables("dislikes") - sorted_dislikes = sorted_vars(dislikes) - return template('hate', globals=globals, dislikes=sorted_dislikes) - - -@route('/resources') -def hate(): - # Grab site specific information - YAML - globals = get_global_variables() - dislikes = get_ld_variables("dislikes") - sorted_dislikes = sorted_vars(dislikes) - return template('hate', globals=globals, dislikes=sorted_dislikes) - - -@route('/nutrition') -def nutrition(): - # Grab site specific information - YAML - globals = get_global_variables() - return template('nutrition', globals=globals) - - -@route('/trans') -def trans(): - # Grab site specific information - YAML - globals = get_global_variables() - return template('trans', globals=globals) - - -@route('/tech') -def tech(): - # Grab site specific information - YAML - globals = get_global_variables() - return template('tech', globals=globals) - - -@route('/resources') -def hate(): - # Grab site specific information - YAML - globals = get_global_variables() - dislikes = get_ld_variables("dislikes") - sorted_dislikes = sorted_vars(dislikes) - return template('resources', globals=globals, dislikes=sorted_dislikes) - - -@route('/dev') -def dev(): - # Grab site specific information - YAML - globals = get_global_variables() - return template('dev', globals=globals) diff --git a/static/css/fonts.css b/static/css/fonts.css index db2bf84..eae184b 100644 --- a/static/css/fonts.css +++ b/static/css/fonts.css @@ -7,32 +7,37 @@ [class^="nf-"]:before { font-family: 'Mononoki'; + font-size: 1.3rem; + color: cornflowerblue; + /* Better Font Rendering (from devicons, et al) */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } + /* ------- social icons ----------- */ .nf-fa-github_alt:before { content: "\f113"; - font-size: 4rem; - color: cornflowerblue; +} + +.nf-fa-github_alt_link:before { + content: "\f113"; + font-size: 4rem !important; } .nf-fa-gitlab:before { content: "\f296"; - font-size: 4rem; - color: cornflowerblue; + font-size: 4rem !important; } .nf-fa-linkedin_square:before { content: "\f08c"; - font-size: 4rem; - color: cornflowerblue; + font-size: 4rem !important; } + /* ------- user icons ----------- */ -.nf-fa-user_secret:before { - content: "\f21b"; -} .nf-mdi-human:before { content: "\f7e5"; @@ -41,3 +46,7 @@ .nf-mdi-account:before { content: "\f503"; } + +.nf-mdi-forklift:before { + content: "\fcc7"; +} diff --git a/static/css/main.css b/static/css/main.css index e6cd6eb..a2c4ae9 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,7 +1,5 @@ -/* This was originally built on: - BLOCKS - Responsive Dashboard Theme - Copyright 2013 - Which was designed and built based on Twitter Bootstrap and created by: - Carlos Alvarez +/* Forked from: + BLOCKS - Copyright 2013 - Carlos Alvarez Since BLOCKS is dead since 2013, this is now a basic user linktree designed and maintained by jessebot[at]linux[dot]com @@ -11,7 +9,7 @@ | Color | Used for | |:-------:|:---------------------------------------| | #1f1f1f | Background Color | - | #3d3d3d | Dash-unit and half-unit Section | + | #3d3d3d | cardclone and half-unit Section | | #262626 | Footer | | #fa1d2d | Red - Used in selectors and paragraphs | | #b2c831 | Green - Used in titles | @@ -73,7 +71,8 @@ h5 { } /* ----------------------- Dash Unit -------------------------- */ -.dash-unit { + +.cardclone { margin-bottom: 30px; padding-bottom: 10px; background-image: url('../images/sep-half.png'); @@ -91,21 +90,21 @@ h5 { filter: alpha(opacity=97); } -.dash-unit:hover { +.cardclone:hover { background-color: #3a3a3a; -moz-box-shadow: 3px 3px 2px 0px #151515; -webkit-box-shadow: 3px 3px 2px 0px #151515; box-shadow: 3px 3px 2px 0px #151515; } -.dash-unit hr { +.cardclone hr { border: 0; border-top: 1px solid #151515; border-top-style: dashed; margin-top: 3px; } -.dash-unit p { +.cardclone p { font-size: 14px; font-weight: 200; line-height: 16px; @@ -117,27 +116,47 @@ h5 { padding-right: 20px; } -.dash-unit bold { - font-family: 'Open Sans', sans-serif; +.cardclone bold { font-size: 26px; font-weight: bold; - color: #fff; + color: #ffffff; vertical-align: middle; } -.dash-unit dtitle { +.c-title { font-size: 11px; text-transform: uppercase; color: #ffffff; - margin: 8px; - padding-top: 4px; + margin: 1px; + padding-top: 0px; + padding-bottom: 2px; + padding-left: 0px; + padding-right: 0px; + height: inherit; +} + +.c-title-social { + margin: 5px; + font-size: 11px; + text-transform: uppercase; + color: #ffffff; + padding: 0px; + height: inherit; +} + +.c-footer-link { + font-size: 11px; + text-transform: uppercase; + color: #ffffff; + margin: 2px; + padding-top: 3px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; height: inherit; } -.dash-unit h1 { +.cardclone h1 { font-family: 'Raleway', sans-serif; font-weight: 300; font-size: 20px; @@ -150,7 +169,7 @@ h5 { text-align: center; } -.dash-unit h2 { +.cardclone h2 { font-family: 'Open Sans', sans-serif; font-weight: bold; font-size: 30px; @@ -163,7 +182,7 @@ h5 { text-align: center; } -.dash-unit h3 { +.cardclone h3 { font-weight: 300; font-size: 15px; line-height: 2px; @@ -175,14 +194,14 @@ h5 { text-align: center; } -.dash-unit h4 { +.cardclone h4 { padding-left: 5px; margin-top: 2px; font-size: 13px; font-weight: lighter; line-height: 1; letter-spacing: 0px; - color: #fff; + color: #ffffff; } @@ -216,11 +235,11 @@ h5 { font-family: 'Open Sans', sans-serif; font-size: 26px; font-weight: bold; - color: #fff; + color: #ffffff; vertical-align: middle; } -.half-unit dtitle { +.half-unit c-title { font-size: 10px; text-transform: uppercase; color: #ffffff; @@ -249,7 +268,7 @@ h5 { font-weight: lighter; line-height: 1; letter-spacing: 0px; - color: #fff; + color: #ffffff; } /**********Styling Elements**********/ @@ -300,14 +319,14 @@ h5 { .modal-header { background-image: url('../images/sep-half.png'); background-color: #4f4f4f; - color: #fff; + color: #ffffff; } input[type=submit] { font-family: 'Open Sans', sans-serif; font-size: 15px; background: #b2c831; - color: #fff; + color: #ffffff; border: none; padding: 8px 28px 10px 26px; *-webkit-border-radius: 4px; @@ -439,25 +458,6 @@ a:hover { text-decoration: none; } - -/********** FooterWrap Section **********/ -#footerwrap { - background: #262626; - background-image: url('../images/sep-half.png'); - padding-top: 25px; - padding-bottom: 40px; - border-top-style: solid; - border-top-width: 8px; - border-top-color: #1d1d1d; - text-align: center; -} - -#footerwrap p { - color: white; - font-size: 12px; -} - - /********** Media Styles **********/ /* portrait tablet */ diff --git a/static/img/linkedin.svg b/static/img/linkedin.svg deleted file mode 100644 index 3206b21..0000000 --- a/static/img/linkedin.svg +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/static/img/noun_rock_monster.png b/static/img/noun_rock_monster.png deleted file mode 100644 index 19b90f9..0000000 Binary files a/static/img/noun_rock_monster.png and /dev/null differ diff --git a/templates/footer.html b/templates/footer.html index 1752243..2cf1796 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -25,4 +25,5 @@ }); +
Fork me on Github <3
diff --git a/templates/footer_main.html b/templates/footer_main.html index fcfde4d..0a8df2c 100644 --- a/templates/footer_main.html +++ b/templates/footer_main.html @@ -8,6 +8,6 @@ $('[data-toggle="tooltip"]').tooltip() }); - + diff --git a/templates/header_band.html b/templates/header_band.html deleted file mode 100644 index 3e25d30..0000000 --- a/templates/header_band.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - MY NEXT BAND - - - - - - - - - - - - - % if globals['fork_me']: - - % end diff --git a/templates/header_resources.html b/templates/header_resources.html index 3de901b..7aa66f3 100644 --- a/templates/header_resources.html +++ b/templates/header_resources.html @@ -34,6 +34,6 @@ - % if globals['fork_me']: - - % end + {% if globals['fork_me'] %} + +{% endif %} diff --git a/templates/index.html b/templates/index.html index ac8eb93..f06671e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,14 +1,15 @@ {% include('header_main.html') %} -
+
-
- - +
+
+ About {{ config_vars['name'] }} - +


- +

{{ config_vars['blurb'] }}

-
-
-
+
+
+
-
- Social Links + +
+
Social Links

   {% for lnk in social_links %} @@ -47,15 +49,15 @@ {% endfor %}
- + +
+
+ {% include('footer_main.html') %} diff --git a/templates/next-band.html b/templates/next-band.html deleted file mode 100644 index cfeb9d4..0000000 --- a/templates/next-band.html +++ /dev/null @@ -1,57 +0,0 @@ -% include('header_band.html') -
-
- - -
-
- - - The Name of My Next Band - -
-
-
-
-
-
-
- Band Monster >:3 -
-
- Submit a band name, and it'll generate some cool art for you. Currently under construction. - - - -
-
-
-
-
-
-
-
- - -
-
- - - Previous Potential Band Names - -
-
-
- % for band_set in bands: -
  • {{band_set[0]}}

  • - % end -
    -
    - -
    -
    - -
    -
    - -% include('footer_main.html') diff --git a/templates/resources.html b/templates/resources.html index 813a55f..92f414f 100644 --- a/templates/resources.html +++ b/templates/resources.html @@ -1,59 +1,63 @@ -% include('header_resources.html') -
    +{% include('header_resources.html') %} + +

    Come learn about things!


    -
    - +
    +
    Health - +

    Boop.
    +
    -
    - +
    +
    Tech Stuff - +

    Boop.
    +
    -
    - +
    +
    Trans Data - +

    Boop.
    +