Skip to content

Instantly share code, notes, and snippets.

@asciimo
asciimo / LfsOsx
Created April 20, 2023 19:18 — forked from vasi/LfsOsx
LFS on OS X from 2005 or so
= LinuxFromScratch using Mac OS X =
Linux From Scratch is a fun way to learn about Linux, but it expects you to already have Linux running. [http://trac.cross-lfs.org Cross-compiling] is already supported but OS X is a little weird--so here are some hints for bootstrapping LFS from OS X. I've only tried this on 32-bit PPC, I have no idea how well or badly it would work on G5 or Intel chips.
Generally, you can follow the [http://cross-lfs.org/view/1.0.0rc4/ppc/ Cross-LFS book], I only refer to areas where changes are needed.
== Chapter 2 ==
=== Partitioning ===
To perform the partitioning, you'll probably want to use a Linux rescue CD. Gentoo's PPC CD has a version of parted that can even resize existing HFS+ partitions non-destructively, I think Debian's does too. Using Disk Utility or a commercial tool like iPartition is an option, but I'm not certain they can create the special partition types Apple_Bootstrap and Apple_UNIX_SVR2.
@asciimo
asciimo / 100bytes.css
Created November 1, 2021 20:10
Short, sweet baseline for an basic HTML page. From https://www.swyx.io/css-100-bytes/
html {
max-width: 70ch;
padding: 3em 1em;
margin: auto;
line-height: 1.75;
font-size: 1.25em;
}
@asciimo
asciimo / comply_lubuntu_18.04.md
Last active March 6, 2020 11:32
Running Comply 1.2.6 on Lubuntu 18.04 (minimal install)

To get Comply running on Lubuntu 18.04 minimal install, I had to:

Download comply-v1.2.6-linux-amd64.tgz from the Comply releases page, and ensure it's my executable path:

curl -LO https://github.com/strongdm/comply/releases/download/v1.2.6/comply-v1.2.6-linux-amd64.tgz
tar -xzvf comply-v1.2.6-linux-amd64.tgz
sudo ln -s $PWD/comply-v1.2.6-linux-amd64 /usr/local/bin/comply

Download the latest pandoc 2.x binary from here because the latest Ubuntu package is 1.19.x

@asciimo
asciimo / gist:f7d1c8e57d20a22b5538b5de4eda7f7a
Created March 14, 2018 22:23
Python oneliner to transform markdown to HTML
python -m markdown -x markdown.extensions.footnotes -x markdown.extensions.tables in.md > out.html
@asciimo
asciimo / circles.pde
Created February 5, 2018 23:36
Processing sketch for generating grayscale, interlocking circles suitable for a desktop background.
// Pressing Control-R will render this sketch.
int x = 50;
int y = 50;
void setup() { // this is run once.
// set the background color
background(255);
@asciimo
asciimo / texmextacos.json
Last active February 4, 2018 22:29
Recipe Schema Example
{
"_id": "6c5cfc1c77bfa802c55f2a8561005f34",
"_rev": "2-8abc0d63720e5f85b74a5af0342b41c3",
"publication_timestmap": "1516779903",
"title": "Vegan Tex-Mex Tacos",
"author": "Brian L. Patton",
"packs": [
{
"id": "a1b2c3",
"name": "Amazing Breakfasts"
@asciimo
asciimo / gateway.js
Last active November 3, 2017 21:35
Get the server's gateway ip address in a node script.
const util = require('util')
const execFile = util.promisify(require('child_process').execFile); // node 8+
const getGatewayIp = () =>
new Promise((resolve, reject) => {
execFile('/sbin/ip', ["route"])
.then(result => {
if (result.stdout) {
const ip_pattern = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
const ip = result.stdout.match(ip_pattern)[0];
@asciimo
asciimo / interested.js
Created October 18, 2017 18:15
How to use Javascript to get a list of everyone who selected "Interested" on a Facebook event
// First, click on the event link that looks like "0 Going · 28 Interested" and then "inspect element" on the modal
const list = document.getElementsByClassName("uiScrollableAreaBody")[6] // Your markup may vary. The One I wanted was index 6
const people = list.getElementsByTagName("span") // HTMLCollection
const peopleArray = [].slice.call(people) // Convert to an array we can map()
peopleArray.map(personEl => personEl.innerText) // Copy the results and clean up in Vim :D
@asciimo
asciimo / mapdemo.html
Created October 1, 2017 06:29
A demo of using the GOogle Maps Javascript API, and toggling groups of markers on and off.
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
A single, continuous slider from Zillow’s Affordability Calculator — allowing the customer to explore various options quickly. Fixed values, such as annual income, monthly debts and down payment are defined once.