Skip to content

Instantly share code, notes, and snippets.

Sluggify One Liner
```
echo "Abcd ; 200-2" | awk '{gsub(/[^[:alnum:]]/,"-");gsub(/-+/,"-");print}'| tr [:upper:] [:lower:]
```

Keep your own offline codepen.

This shell script, a riff on https://github.com/umpox/TinyEditor , lets you prefill TinyEditor's text areas with files from a directory.

html="$(cat $1/html.html)"
css="$(cat $1/css.css)"
js="$(cat $1/js.js)"

test ical

{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Richard Traube",
"label": "WordPress Developer",
"image": "",
"email": "rich.traube@gmail.com",
"phone": "773-964-2941",
"url": "",
"summary": "In my 30 year library career I used mixed technology to help people become more productive, meet deadlines, and achieve objectives. I have never met a command line I didn't like. I am currently looking for work in IT, web development, data transformation, office administration, and higher education.",
@trauber
trauber / slides.md
Created October 29, 2020 17:53
slides

Slide one


Slide two

???

with notes

Just added some custom css to TS theme in "customize->additional css".

h1.entry-title {
box-sizing: border-box;
color: rgb(53, 53, 53);
font-family: Alice;
font-size: 38px;
font-weight: 600;

Processing iContacts HMTL Email into WordPress

  • Download the message. This yields a .eml file.
  • Run munpack on the .eml file. This will break the file into several files named part1 part2, etc, one of which will be HTML with some non-ascii characters. Let's say part2 for example.

This might work with other HTML emails. I've only tried iContacts.

munpack -t file.eml
awk '{ gsub(/\377/,""); print; }' part2 > tmp.html

HTML for WordPress Responsive Columns

This uses classes from /wp-includes/css/dist/block-library/style.min.css?ver=5.4.1 .

<div class="contain">
  <div class="wp-block-columns alignwide has-3-columns">
    <div class="wp-block-column">...</div>
    <div class="wp-block-column">...</div>
 ...

Python Namedtuple to Dict to JSON

I've patched this together from several different tutorials.

from collections import namedtuple
import json

dict_list = []

Bash for Times to Use with Remind

# Calculate number of minutes since start of day.
# Use this with output of `remind -s` to calculate
# task duration.

GENERIC_DATE=$(date +'%b %d %Z %Y') # Example output: "Feb 23 EST 2020"
START_OF_DAY_IN_SECONDS_SINCE_THE_EPOCH=$(date --date="$GENERIC_DATE" +'%s') # That date spec provides sste at midnight.
NOW_IN_SECONDS_SINCE_THE_EPOCH=$(date +'%s')