Skip to content

Instantly share code, notes, and snippets.

alifeee /
Last active April 5, 2024 15:46 — forked from bmcbride/
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
alifeee /
Created March 26, 2024 20:03
Simple bar chart generation with bash
# make bar chart from $prog, $total, $n_seg as $1 $2 $3
# example:
# > ./ 25 100 12
# ███░░░░░░░░░
awk -v prog=$1 -v TOTAL=$2 -v TOTSEG=$3 'BEGIN {
frac = prog / TOTAL;
segs = frac * TOTSEG;
segs_int = int(sprintf("%.0f", segs));
alifeee /
Created March 17, 2024 17:06
Remove all CSS styles from HTML files with bash
# script to remove stylesheets, style tags, and inline styles from an HTML file
# 1. remove <link rel="stylesheet" ...>
# 2. remove <style> ... </style>
# 3. remove style="..." attributes
# notes:
# perl "0777" is so that perl sees newlines as "any character" (so <link> can wrap onto new lines)
# "|gms" helps with the same thing. see
# example:
# ./ index.html > index-naked.html
alifeee /
Created March 14, 2024 21:42
FFmpeg commands

FFmpeg Commands

Turn mp4 into gif

Used here. From here.

ffmpeg -y -i input.mp4 -filter_complex "fps=5,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" output.gif
alifeee /
Created March 14, 2024 20:24
How to use Ruby and Jekyll on Linux

Using Ruby on Linux

Install Ruby + Gems

sudo apt-get install ruby-full
gem install bundler
bundle config set --local path 'vendor/bundle'
bundle install
alifeee /
Last active March 15, 2024 18:54
Plot graphs using the terminal (bash)

Bash Graphs

Plot graphs using the terminal. E.g.,

> cat sensor.txt | awk -F ':| *' '{print $2}' | eplot -d -t CO2 2> /dev/null

  4000 +-------------------------------------------------------------------+
       |         +      +.+.+       +         +         +        +         |
       |                :    .+                                CO2 +.....+ |
alifeee /
Created March 8, 2024 02:18
Convert a font (`.woff` or otherwise) filename to CSS classes
# converts a font (.woff) filename to a CSS @font-face and class-selector based on filename
# example:
# ./ "path/to/my-font.woff"
# with multiple files
# find path/to/fonts -name "*.woff" -exec ./ {} \;
# get name from regex match
if [[ $1 =~ $name_regex ]]; then
alifeee /
Created February 29, 2024 16:36
Convert GIMP's `.gpl` file to CSS variables
# convert a Gimp colour palette (.gpl) to a list of CSS variables
# example:
# ./ my-palette.gpl > my-palette.css
# converts
# ----- my-palette.gpl -----
# GIMP Palette
# Name: My Palette
# Columns: 3
# 255 0 0 Red
alifeee /
Created February 8, 2024 15:15
Squarespace RSS combiner
# combines SquareSpace RSS feeds
# Squarespace default feed (e.g., only returns the current month
# This script fetches the current month and the next two months and combines them into a single RSS feed
# The script is intended to be run as a cron job
# It should work for any SquareSpace site (assuming they use the same query variable format)
# usage e.g.,
# ./ > /var/www/html/
# get today month and year
alifeee /
Last active February 7, 2024 22:26
How to run things as a service

How to run things as a service on Ubuntu

I run things on my server. I'd like to run them in the background, so they restart when the server restarts.

I was running them "in the background" with tmux, which I had to set up again every time the server restarted. This was annoying. So, here I run them as a service.

I had a vague knowledge of services, because some things I use are one, like nginx and murmur for mumble.