Skip to content

Instantly share code, notes, and snippets.

@alifeee
alifeee / google-form-to-github-issue.md
Last active April 5, 2024 15:46 — forked from bmcbride/google-form-to-github-issue.md
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
alifeee / bar.sh
Created March 26, 2024 20:03
Simple bar chart generation with bash
#!/bin/bash
# make bar chart from $prog, $total, $n_seg as $1 $2 $3
# example:
# > ./bar.sh 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
alifeee / naked.sh
Created March 17, 2024 17:06
Remove all CSS styles from HTML files with bash
#!/bin/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 https://regex101.com/
# example:
# ./naked.sh index.html > index-naked.html
@alifeee
alifeee / ffmpeg-commands.md
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
alifeee / ruby-and-jekyll-on-linux.md
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
alifeee / bash-graphs.md
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
alifeee / woff-to-css.sh
Created March 8, 2024 02:18
Convert a font (`.woff` or otherwise) filename to CSS classes
#!/bin/bash
# converts a font (.woff) filename to a CSS @font-face and class-selector based on filename
# example:
# ./filename_to_css.sh "path/to/my-font.woff"
# with multiple files
# find path/to/fonts -name "*.woff" -exec ./filename_to_css.sh {} \;
# get name from regex match
name_regex='\/([^\/]*)\.woff$'
if [[ $1 =~ $name_regex ]]; then
@alifeee
alifeee / gpl-to-css.sh
Created February 29, 2024 16:36
Convert GIMP's `.gpl` file to CSS variables
#!/bin/bash
# convert a Gimp colour palette (.gpl) to a list of CSS variables
# example:
# ./gpl-to-css.sh my-palette.gpl > my-palette.css
# converts
# ----- my-palette.gpl -----
# GIMP Palette
# Name: My Palette
# Columns: 3
# 255 0 0 Red
@alifeee
alifeee / squarespace-RSS-combiner.sh
Created February 8, 2024 15:15
Squarespace RSS combiner
#!/bin/bash
# combines SquareSpace RSS feeds
# Squarespace default feed (e.g., https://www.treehousesheffield.com/events?format=rss) 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.,
# ./combinerss.sh https://www.treehousesheffield.com/events?format=rss > /var/www/html/treehousesheffield.com/events.rss
# get today month and year
@alifeee
alifeee / ubuntu-run-as-a-service.md
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.

Firstly