log.py:
import markdown
md = markdown.Markdown(extensions = ['meta', 'attr_list'])
import os
def convertlog(log, pagename):
file = open(logpath + log, 'r')
body = md.convert(file.read())
print(log,pagename)
file.close()
body = makestamp(pagename) + '<hr>' + body
if 'tags' in md.Meta:
tags = md.Meta['tags'][0].split(', ')
body = makelinktags(tags) + ' ' + body
body = '\n<section>' + body + '\n</section>'
return body
def makelinktags(tags):
anchor_tag = '<a href="/log/{0}.html">{0}</a>'
taglist = [anchor_tag.format(tag) for tag in tags]
tagline = ', '.join(taglist)
return tagline
def makestamp(pagename): # permalink for that entry
return '<a href="/log/' + pagename + '.html">.:.</a>'
def makepage(body):
file = open('../templates/header.txt', 'r')
header = file.read()
file.close()
file = open('../templates/footer.txt', 'r')
footer = file.read()
file.close
html = header + body + footer
return html
def savefile(html, savepath):
savefile = open(savepath, 'w')
savefile.write(html)
savefile.close()
logpath = '../md/log/'
logpile = sorted(os.listdir(logpath))
logbook = {}
logpages = []
# convert each log
for log in logpile:
fullpath = os.path.join(logpath, log)
if os.path.isdir(fullpath):
continue
else:
filetype = log.split('.')[-1]
pagename = log.split('.')[0]
if filetype == 'txt' or filetype == 'md':
logbook[pagename] = convertlog(log, pagename)
# make each individual page
for page in logbook:
html = makepage(logbook[page])
logpages.append(logbook[page])
savepath = '../html/log/' + page + '.html'
savefile(html, savepath)
print(savepath)
# make one page for all entries
logpages.reverse()
logindex = makepage('\n'.join(logpages))
savepath = '../html/log/index.html'
savefile(logindex, savepath)
cool got this page to be generated with webmaster
gonna take a break for a few days and make it prettier
webmaster plans:
finally able to access pi files on everything with a relatively simple method. no installing servers or anything really.
to mounth the folder as a drive on windows you need to install both of these things:
switching plans up for the webmaster guy. i was finally getting the hang of nodejs but i'm going to go with python. the code looks way prettier and it worked the second try. i've never written anything more than 5 lines and have it work the first try.
not on my main computer tonight but holding myself to logging at least once a month. will edit this all again in a couple days, just putting this here for now
webmastertest3.py
import markdown
md = markdown.Markdown(extensions = ['meta', 'attr_list'])
import os
def makepage(mdfile):
file = open('../templates/header.txt', 'r')
header = file.read()
file.close()
file = open('../md/' + mdfile, 'r')
body = md.convert(file.read()) + '\n' + str(md.Meta)
file.close()
file = open('../templates/footer.txt', 'r')
footer = file.read()
file.close
html = header + body + footer
savefile = open('../html/' + mdfile[:-3] + 'html', 'w')
savefile.write(html)
savefile.close()
for mdfile in os.listdir('../md'):
if mdfile[-3:] == "txt":
makepage(mdfile)
print(mdfile)
making some good progress on this webmaster
to do before uploading: - reformat most pages to markdown - reset links/imgs all pages (still need to fix space.html imgs and links) - add in classes for elements - github - still static html
still to do:
getting news from wikipedia via api?
how to use this api thing to get articles from wikipedia to show up on a page?, will get back to this
running some tests using node to convert markdown. js is always less intimidating when it's over
webmaster.html just tests so far, will add more
getting the hang of this, just gotta rewrite everything into markdown, maybe not everything but most things
this might be my last manual blog post, hopefully have this a little more automated next month.
just finished year one of survey school. summer break, summer jobs, summer love
still tweaking the page styles for this site before i overhaul all the html and make a consistant web layout. i've also been looking into markdown and really enjoy writing with it. this lead down a rabbit hole of static site generators and different approaches to go from markdown (plaintext) to markup (html).
i think the route i like is using node to take a folder full of markdown files and convert them into html.
store markdown articles in a database/folder
store html, css, and js templates in database/folder
parse/convert markdown to html
store html file in database/folder
ideally i would like to have a database/folder tree of txt files, media and templates that i manage instead of all these html files. focus on content instead of tedious bits.
tag idea list: - geo, cad, gis - project, idea, log - materials, technology - circuits, power - radio, ham, signals - cpu, hardware, software - web, server, - art, webvr, photos, words
played with a-frame for the first time in a while. i found i can model in autocad and export to a STL file, open this in blender, save as gtlf file and embed this in an a-frame scene.
got a general idea for a link world, every door takes you to a different webvr world. still have to do a lot to make thing more stable and easy to manage
i am the static
backed up R52 thinkpad windows XP to an IMG file, installed raspberry pi OS to learn more about using linux and have a dedicated machine for talking to my raspberries.
the first thing i tried to set up was an SDR program to use my RTLSDR. i actually forget the results and resources used here, will come back and add more about this
i lost a lot of the links that helped me along the way but will try to build this into something i can follow when i inevitably break it and have to start over
should start a geo log for survey, cad, gis
how to modify coordinate systems in autocad civil3d:
_mapcslibrary
search nova scotia 2010
duplicate zone 5
remove "2" at start of false easting
save
crap doing a dated notebook makes me
strangely aware of time all of a sudden
to-do: start a raspberry pi/micro controller page - move all notes from radio/cpu pages to there - find inspiration and time to start aduino - control motors and gears with a computer already
(will always be rearranging this order) geouniversal materia materials and chemistry artifacts tech and components circuits electro signals sensors and data cpu processing and memory trajectory rockets and orbits space navigation star maps and solar system models
made a little time to work on schematics
would like to have a lot more on here
plus pictures of them (not?) working
work/school/other work/radio/hermitage prep
space.js - model data - geometry - units - reference systems - motion - gravity - rendering - interface
trying to start a web log again, see how long this lasts
current site map and hot ideas:
- home page
- links
- geouniversal
- materia
- machines
- circuits - add in schematics
- signals
- cpu
- space
- radio - maybe make a satellites page?
- noaa-log - add newest day?
- web
- cmd v3 - i forgot about this, hmm
- iching - fix it, check on all platforms
- js archive
- midnite - add more photo pages
- about
to-do:
- figure out mobile vs desktop text size and pre text size
- upload more photos
- fix a bunch of text
- go to bed right now
and image inverter / archive found negatives:
function updateImage(amount) {
var inverttest = document.getElementById("inverttest");
inverttest.style.filter = "invert(" + amount/100 + ")";
debug.innerHTML = amount;
}
test