+ Required meta data for active posts
* Moving drafted never posted stuff to an unused folder
This commit is contained in:
117
content/drafts/build.md
Normal file
117
content/drafts/build.md
Normal file
@@ -0,0 +1,117 @@
|
||||
---
|
||||
title: "How this site came to be"
|
||||
date: July 22, 2018
|
||||
draft: true
|
||||
---
|
||||
|
||||
# How this site came to be
|
||||
|
||||
## Tech
|
||||
|
||||
The """"tech-stack"""" for this site is [pandoc](https://pandoc.org/) and a single shell script.
|
||||
Ok, technically there's also the issue about python but really you don't need to use it since the site pages build anyways.
|
||||
|
||||
Yea so here's the shell(bash) script.
|
||||
I'm going to remove any bashisms soon enough but am very lazy so this is the best I got for ya.
|
||||
```
|
||||
#!/bin/bash
|
||||
rootDir='./site/'
|
||||
targetDir='post/'
|
||||
|
||||
post() {
|
||||
echo Building: $1
|
||||
tmp=".swap"
|
||||
full=".fullswap"
|
||||
base=`basename $1`
|
||||
# First build the content of the site
|
||||
pandoc $1 > $tmp
|
||||
# Title, images and tables get added/fixed here
|
||||
sed "s/{TITLE}/<title>${base%.*}<\/title>/g" ./temp alias in your bashrc and you’re good to go.
|
||||
|
||||
Rambled guess time
|
||||
My guess on how the alias is that bash doesn’t try to figure out that you want to use vim since you’ve only typed a single v in this case; therefore tab-completion would go unnoticed?
|
||||
Say you had a directory with files:
|
||||
|
||||
first
|
||||
second
|
||||
lates/post-header.html > $full
|
||||
cat $tmp ./templates/post-footer.html >> $full
|
||||
sed -i 's/<img/<img class="pure-img"/g;s/<table>/<table class="pure-table">/g' $full
|
||||
|
||||
# Move things to proper directory and cleanup
|
||||
mv $full "$rootDir/$targetDir/${base%.*}.html"
|
||||
rm -f $tmp
|
||||
}
|
||||
|
||||
build_all() {
|
||||
mkdir -p $rootDir/post/ $rootDir/fonts/ $rootDir/media/img/
|
||||
|
||||
cp style.css "$rootDir"
|
||||
cp prebuild/post/style.css "$rootDir/post/"
|
||||
|
||||
cp fonts/* $rootDir/fonts/
|
||||
|
||||
cp img/ $rootDir/media/img/ -r
|
||||
mv $rootDir/media/img/favicon.png $rootDir/
|
||||
|
||||
# Try to get xargs to deal with this ugliness
|
||||
for r in prebuild/*md;do
|
||||
post $r
|
||||
done
|
||||
for p in prebuild/post/*md;do
|
||||
post $p
|
||||
done
|
||||
}
|
||||
|
||||
_help() {
|
||||
echo 'Options:
|
||||
-h show this prompt
|
||||
-p [postDirectory/*] (takes a list of paths to build from)
|
||||
-r build root pages
|
||||
-s copy stylesheets
|
||||
-l run live server'
|
||||
}
|
||||
server() {
|
||||
cd $rootDir
|
||||
echo 'Address: 0.0.0.0:8080'
|
||||
python -m SimpleHTTPServer 8080
|
||||
}
|
||||
|
||||
if [ -z $1 ]
|
||||
then
|
||||
_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while getopts ":aslrhp:" opt;do
|
||||
case "$opt" in
|
||||
a)
|
||||
build_all;;
|
||||
s)
|
||||
cp style.css "$rootDir"
|
||||
cp prebuild/post/style.css "$rootDir/$targetDir"
|
||||
exit 0
|
||||
;;
|
||||
r)
|
||||
# Fix targetDir so that it points to the root of the site output
|
||||
targetDir=''
|
||||
post './prebuild/about.md'
|
||||
post './prebuild/links.md'
|
||||
post './prebuild/index.md'
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
for file in ${@:2};do
|
||||
post $file
|
||||
done
|
||||
;;
|
||||
h)
|
||||
_help;;
|
||||
l)
|
||||
server;;
|
||||
esac
|
||||
done
|
||||
|
||||
```
|
||||
|
||||
## Story
|
||||
24
content/drafts/deploy.md
Normal file
24
content/drafts/deploy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Delivering whole OS's in Gitlab's CI/CD"
|
||||
date: 0000-00-00
|
||||
draft: true
|
||||
---
|
||||
|
||||
# Delivering whole OS's in Gitlab's CI/CD
|
||||
## Way easier than you may think
|
||||
|
||||
Lately I've been trying to learn about deploying things in remote pipelines continuously so I've taken to using Gitlab's own provided CI pipelines to... well _do stuff_.
|
||||
After some bumps in the road I've learned a few things:
|
||||
|
||||
## Setting up docker images isn't that hard
|
||||
|
||||
Maybe it's because I'm not doing _complex things_ or maybe because I've dealt with some awful problems on Debian before but setting up Debian images really aren't hard to setup.
|
||||
The best part is that unlike real full installations they're super easy to just nuke and start fresh over again(assuming you get to that point).
|
||||
Usually however I just tweak the Docker script, re-run and done.
|
||||
|
||||
> Where's the image bro
|
||||
|
||||
Here you go: [dank docker image](https://hub.docker.com/repository/docker/shockrah/osdev-build)
|
||||
|
||||
To save you a click, its a docker image which I use to provide ISO's of my [handwritten operating system](https://gitlab.com/shockrah/jankos).
|
||||
It's nice because now I can easily provide bootable files for people to test the code I've written without having to compile any code!
|
||||
48
content/drafts/drive-recovery.md
Normal file
48
content/drafts/drive-recovery.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: "Drive Recover"
|
||||
date: 0000-00-00
|
||||
draft: true
|
||||
---
|
||||
|
||||
# Drive Recovery
|
||||
|
||||
I've gone through too many hard drives and solid state drives to count and they've piled up over the years. So let's find out which ones are actually dead, and which ones I can recover.
|
||||
|
||||
For each of these tests I use a combination of the following tools to diagnose what's wrong with the drives.
|
||||
Not the data or the file systems but the physical drives because if the hardware is good then I should be able to install whatever file system I want and move on.
|
||||
_Everything here is done on Debian as the tooling is super easy to get a hold of_.
|
||||
|
||||
```
|
||||
badblocks
|
||||
Check for bad blocks on the drives
|
||||
smartctl
|
||||
Grab SMART data off the drives
|
||||
mount
|
||||
If a filesystem is found I can pull stuff off the drive once mounted
|
||||
Most drives don't have anything though
|
||||
```
|
||||
|
||||
## Kingston SSD
|
||||
|
||||
First mounting drive to see what its about `mount` tells me the filesystem is unclean
|
||||
It still mounted but all I found was this:
|
||||
|
||||

|
||||
|
||||
It should be noted that this drive has gone through multiple partition schemes.
|
||||
Its also gone from [Windows] to [Grub, Windows, Linux] back to [Windows, Linux] and then back again at some point.
|
||||
|
||||
With `sudo badblocks -v /dev/sdc1 > bads.txt` no errors were found so I moved on from there.
|
||||
|
||||
Finally I used `smartctl` which can be found in the Debian buster repositories in the `smartmontools` package.
|
||||
Luckily my drive was found in the tool's database so it was able to read back useful data from the drive.
|
||||
|
||||
One `smartctl -A /dev/sdc` later and I found out that the drive was basically functioning normally, nothing was out of the ordinary.
|
||||
|
||||
If you have a Kingston SSD and don't know what the data means then [look at this](https://media.kingston.com/support/downloads/MKP_306_SMART_attribute.pdf).
|
||||
|
||||
At this point I just reformatted the drive and moved on to the next drive: a Western Digital Blue 1TB Drive.
|
||||
|
||||
## Western Digital Blue 1TB
|
||||
|
||||
This drive is somewhat new as my old WD Blue was giving me issues when booting into Windows, and for some reason contained another old Grub installation
|
||||
36
content/drafts/eco-eats.md
Normal file
36
content/drafts/eco-eats.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
title: Economical Eats
|
||||
date: 0000-00-00
|
||||
draft: true
|
||||
---
|
||||
|
||||
# Economical Eats
|
||||
## A dense packing of information those in recently found hard times
|
||||
|
||||
It's official: your _broke and need help, but food is expensive and you're starving, what do you do?_ Let me show you.
|
||||
|
||||
## Precursor
|
||||
|
||||
* These tips are general purpose and can be changed to fit your needs
|
||||
|
||||
* The target audience is anyone who hasn't been _broke_
|
||||
|
||||
* These tips are to arm you with the knowledge to survive in modern circumstances
|
||||
|
||||
## Good Wholesome Tips
|
||||
|
||||
## Ugly Tips
|
||||
|
||||
## Blackpill
|
||||
|
||||
> These are absolute last resort and if you find yourself here either you fucked up or still have a chance to fix something else
|
||||
|
||||
> Nearly all of the following tips are demonstrably awful for you in some way
|
||||
|
||||
## More resources
|
||||
|
||||
Here's a bunch of links
|
||||
|
||||
## Afterthoughts
|
||||
|
||||
todo
|
||||
47
content/drafts/local-esports.md
Normal file
47
content/drafts/local-esports.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: Esports Post
|
||||
date: 0000-00-00
|
||||
draft: true
|
||||
---
|
||||
|
||||
# Esports Post
|
||||
|
||||
So for the past week or so I've been deliberating progress over an e-sports related project of mine: [scuffed-league](https://gitlab.com/shockrah/scuffed-league).
|
||||
The whole idea here is that I like tournaments I still believe that proper long-running leagues are the preferable choice for keeping spectators and competitors around for long periods of time.
|
||||
|
||||
## The plan for building
|
||||
|
||||
Let's go through the process of building from start to current.
|
||||
|
||||
1. I wanted to replicate the experience of using sites like cevo or esea from my own competitive history but, _those have had years to build and mature_.
|
||||
|
||||
Something which to be honest never really struck until I had built a few bare pages. I say bare because quite frankly, every page I made had nearly no content to show for. It was also unlikely that I was going to be able to fill them with content for a long time.
|
||||
|
||||
Issue: cevo/esea/faceit all support multiple leagues, with multiple divisions in multiple games with multiple tournaments and prizes, news, drama, editors, etc.
|
||||
There was no way I could fill all these things like a full team of content creators could.
|
||||
|
||||
Solution: Start with one game, _Diabotical_ with one league with one division, and a second game mode.
|
||||
|
||||
This meant that I could make a ~~meme~~one-page webapp thing.
|
||||
As the name implies its literally one page which makes it really easy to fill the page with content.
|
||||
At my scale the amount of content I have to serve up is so small that things shouldn't feel cluttered but will still feel like there's a lot going on.
|
||||
|
||||
|
||||
2. I have some data to store and some of it is really strange do I go with SQL, Redis, Firebase, what?
|
||||
|
||||
Some data fits really easily into a table: like user data. Every user can be part of 1 team-league 1 duel-league and then has some basic info about them username/password.
|
||||
Jam that into a table and its easy to query, update, and remove users.
|
||||
|
||||
Even the team data isn't too bad: `captain|member2|member3|teamname|?`. The only issue is the match data.
|
||||
The problem is how we store match history.
|
||||
|
||||
3. I have to store match history for each team and it has to relate to other teams as entries could be related to one another.
|
||||
|
||||
If that prompt makes it seem like each team requires a structure to hold previous matches then you would be right.
|
||||
If I had gone with this question to answer it I would have ended up with a really weird system where I would have to cross reference things in multiple databases and then worry about huge latency.
|
||||
|
||||
Reframing the question to "_What data does 1 match really have_".
|
||||
To actually get to this point however I had to go through a few iterations of holding match data.
|
||||
|
||||

|
||||
|
||||
66
content/drafts/pop-dwm.md
Normal file
66
content/drafts/pop-dwm.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: "DWM and POP!\_OS"
|
||||
date: 0000-00-00
|
||||
draft: true
|
||||
---
|
||||
|
||||
# DWM and POP!\_OS
|
||||
|
||||
|
||||
## tl;dr
|
||||
|
||||
Make a `/usr/share/xsessions/dwm.desktop` file with contents listed below and a /comfy/ script.
|
||||
|
||||
## Doing the thing tho
|
||||
|
||||
1. We need a `/usr/share/xsession/dwm.desktop` file. Mine looks like this:
|
||||
|
||||
|
||||
```
|
||||
[Desktop Entry]
|
||||
Name=DWM
|
||||
Comment=This session logs in to DWM
|
||||
Exec=/home/shockrah/Rice/dwm-launcher.sh
|
||||
Type=Application
|
||||
```
|
||||
|
||||
Nothing to crazy its basically a `toml` config with an executable as the entry point of the DE.
|
||||
For reference here's the official Pop OS config:
|
||||
|
||||
```
|
||||
[Desktop Entry]
|
||||
Name=Pop
|
||||
Comment=This session logs you into Pop
|
||||
Exec=env GNOME_SHELL_SESSION_MODE=pop /usr/bin/gnome-session --systemd --session=pop
|
||||
TryExec=/usr/bin/gnome-shell
|
||||
Type=Application
|
||||
DesktopNames=pop:GNOME
|
||||
X-GDM-SessionRegisters=true
|
||||
X-Ubuntu-Gettext-Domain=gnome-session-3.0
|
||||
```
|
||||
|
||||
This time there's more fluff but you can ignore it for the most part(I think).
|
||||
|
||||
2. Now let's look at that script I have have [/home/shockrah/Rice/dwm-launcher.sh]:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
# This script is used to mimic an xinitrc to some degree
|
||||
|
||||
set -x
|
||||
eval `ssh-agent`
|
||||
|
||||
compton --backend glx --xrender-sync --xrender-sync-fence -b
|
||||
bright 50 DWM# custom brightness script
|
||||
|
||||
feh --randomize --bg-fill ~/Pictures/Papes/* &
|
||||
|
||||
statline &
|
||||
exec dwm
|
||||
```
|
||||
|
||||
Nothing crazy right? Yeap that's it really to setup DWM with any changes you might have easily with Pop OS.
|
||||
|
||||
In case you're wondering here's what my setup currently looks like:
|
||||
|
||||

|
||||
102
content/drafts/quick-update.md
Normal file
102
content/drafts/quick-update.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# Building overhaul
|
||||
|
||||
Apart from the switch to a more _night friendly_ site style-sheet I've also now switch to a new build system for my not-a-blog.
|
||||
Full script at the bottom. [Repo link](https://gitlab.com/shockrah/site-generator).
|
||||
|
||||
The nice thing about this new script? Way more features, more _unixy_ so it ends up being really straight forward to use, oh and it has a nice name now **gensite**. The only major dependency it has is `pandoc` but I'm slowly going to phase that out for another script which accomplishes the same thing so far; it just can't do tables yet.
|
||||
|
||||
Anyway I've been messing about with more shell scripting things as I've been _ded_ for nearly 3 weeks on account of a really epic eye infection which has left me needing glasses.
|
||||
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
# Uses pandoc to turn markdown into html for my personal blog
|
||||
|
||||
mirror=.mirror/
|
||||
|
||||
assert_arg() {
|
||||
[ -z $1 ] && echo No argument provided && exit 1
|
||||
}
|
||||
|
||||
mirror_scaffold() {
|
||||
# Setup mirror directory so that we can later truck through building new posts and pages
|
||||
mkdir -p $mirror/
|
||||
cp -r media/ $mirror/media/
|
||||
cp partials/style.css $mirror/
|
||||
}
|
||||
|
||||
fix_tables_imgs_pure() {
|
||||
sed -i "s/{TITLE}/<title>$(basename --suffix=.html 1)<\/title>/g" "$1"
|
||||
sed -i 's/<img/<img class="pure-img"/g' "$1"
|
||||
sed -i 's/<table>/<table class="pure-table">/g' "$1"
|
||||
}
|
||||
|
||||
create_post() {
|
||||
fname=$(basename --suffix=.md $1).html
|
||||
mkdir -p $mirror/post/
|
||||
pandoc $1 | cat partials/header.html - partials/footer.html \
|
||||
> $mirror/post/$fname
|
||||
|
||||
fix_tables_imgs_pure $mirror/post/$fname
|
||||
}
|
||||
|
||||
build_root_page() {
|
||||
fname=$(basename --suffix=.md $1).html
|
||||
mkdir -p $mirror/
|
||||
if [ ${1: -5} = ".html" ];then
|
||||
cat partials/header.html $1 partials/footer.html > $mirror/$fname
|
||||
else
|
||||
pandoc $1 | cat partials/header.html - partials/footer.html \
|
||||
> $mirror/$fname
|
||||
fi
|
||||
fix_tables_imgs_pure $mirror/$fname
|
||||
}
|
||||
|
||||
refresh_root_src() {
|
||||
cp root/* $mirror
|
||||
}
|
||||
|
||||
copy_media() {
|
||||
mkdir -p $mirror/media/
|
||||
cp root/style.css $mirror/
|
||||
cp -r media/ $mirror/
|
||||
}
|
||||
|
||||
new_project() {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
mkdir -p media/fonts/ media/img/
|
||||
mkdir partials/ posts/ pages/ root/
|
||||
touch partials/header.html partials/footer.html
|
||||
echo Project \""$1"\" created.
|
||||
}
|
||||
|
||||
_help_prompt() {
|
||||
cat <<EOF
|
||||
Options:
|
||||
new project_path: Create a new project folder
|
||||
P|page file.path: Build the root level page
|
||||
p|post file.path: Build that one post into the site mirror folder's posts directory
|
||||
r|root file.path: Build that root page, these live like /index.html /about.html etc.
|
||||
R|roots: Copy over the new/updated root resources
|
||||
m|media: Copy over the media folder contents
|
||||
s|scaffold: Build mirror directory
|
||||
server: Run python live server
|
||||
EOF
|
||||
}
|
||||
|
||||
[ -z $1 ] && _help_prompt && exit 0
|
||||
|
||||
opt=`echo $1 | tr -d '-'`
|
||||
case $opt in
|
||||
new) assert_arg $2;new_project $2;;
|
||||
P|page) assert_arg $2; build_root_page $2;;
|
||||
p|post) assert_arg $2;create_post $2;;
|
||||
r|root) assert_arg $2;build_root_page $2;;
|
||||
R|roots) refresh_root_src;;
|
||||
m|media) copy_media;;
|
||||
s|scaffold) mirror_scaffold;;
|
||||
server) cd $mirror && python -m SimpleHTTPServer 8080;;
|
||||
*) _help_prompt;;
|
||||
esac
|
||||
```
|
||||
22
content/drafts/syncthing.md
Normal file
22
content/drafts/syncthing.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Syncthing and Remote File Management
|
||||
|
||||
> What is [syncthing](https://syncthing.net/)?
|
||||
|
||||
It's a free and open source project that basically keeps your files synchronized across multiple devices.
|
||||
|
||||
It woks like so(in my setup):
|
||||
|
||||
```
|
||||
Listen Server => Gets folders and things shared with it
|
||||
PC => usually uploads stuff to the listen server
|
||||
Phone => usually just pulls down updates from the listen server
|
||||
```
|
||||
|
||||
I personally use Syncthing to keep my ever growing music library and Book/Papers collection up to date on my phone and PC.
|
||||
|
||||
> Can you cut out the middle man by removing that server?
|
||||
Yes but I'm lazy and this give me the option of running syncthing on my laptop and pull down changes from anywhere without much hassle.
|
||||
|
||||
> Where do yo host this listen server?
|
||||
For hosting I use [IONOS](https://www.ionos.com/) since VPS's only cost 2 USD a month. Currently it's running Debian 10 Buster.
|
||||
|
||||
24
content/drafts/train.md
Normal file
24
content/drafts/train.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Trains are Weird
|
||||
|
||||
## y does cali succ at train
|
||||
|
||||
I've come to the conclusion that California has no idea how to do public transportation.
|
||||
Trains for instance get some of the __F A T T E S T__ delays imaginable.
|
||||
Not unlike any other system of transportation like planes or buses, but with trains there's the added bonus that it can stop, and do nothing, mid travel.
|
||||
|
||||
Most countries seemed to have figured out that putting trains on street level means car traffic slows down, and trains have to slow down too.
|
||||
Here in Cali though, we don't use train tunnels in cities.
|
||||
_Before you say something about earthquakes, that's not actually the reason why_.
|
||||
The actual reason, we just suck at public transport.
|
||||
The absolute state of the freeways here is also pretty hilarious; instead of building better freeway routes we just add more lanes which compounds traffic problems.
|
||||
|
||||
## still neat tho
|
||||
|
||||
Not even gonna lie, it's kinda fun being on the train; _when you're actually moving_.
|
||||
Mostly because people that go on trains lose their minds about being locked in a rolly tin can in the woods really quick.
|
||||
That means after about an hour and in people start wandering around and dropping the maddest _truth bombs_ and _conspiracy theories_ I've ever seen.
|
||||
|
||||
Sick shit to witness and journal about but after delays, __literally every trip__ I've decided that I'm just going to spend a tiny bit more and take the plane to get around Cali.
|
||||
|
||||
_Shoutout to the guy that crashed into the train ahead of me in the middle of rush hour traffic.
|
||||
That s1ck 2 hour delay was litty._
|
||||
Reference in New Issue
Block a user