Skip to content

Instantly share code, notes, and snippets.

View rmbrntt's full-sized avatar
🏂

Ryan Barnett rmbrntt

🏂
View GitHub Profile

WIP

--ignore-installed

Ryan's Arch Linux installation guide

note: this guide was modified from https://github.com/michaelmcandrew/arch-install

Arch Linux does not have an automated installation process. Instead, it offers a live CD that boots to a prompt with a minimal set of packages and scripts that can be used to install a system and an accompanying installation guide, available at https://wiki.archlinux.org/index.php/installation_guide.

The guide is comprehensive but takes a long time to grok in its entirety. Hence I have written this guide, that documents the specific steps I take to install Arch Linux on my ThinkPad x220, Dell xps13 and Zotec Nano AD10. It is also a learning exercise in Arch Linux and some 'low level' Linux topics.

This guide was originally written in July 2017 and last updated in November 2017. If you're reading this guide much later, then things are likely to have moved on and you may want to consult the Arch Wiki for more up to date techniques and components, etc.

It's worth remembering that, althoug

# Quick js utils and functions I don't want to rediscover every 3 months
// create an object with keys from the range length of another object
// in: {a: null, b: null}
// out: {1: false, 2: false}
// why? Used an indexed dict to track the state of a grid of items by their index
Array.from({length: Object.keys({a: null, b: null}).length}, (v, k) => k+1)
.reduce((o, key) => ({ ...o, [key]: false}), {})
@rmbrntt
rmbrntt / Hoverable.js
Created October 16, 2018 15:53
React Hoverable Render props example
import React, {Component} from 'react';
class Hoverable extends Component {
constructor() {
super();
this.state = {
isMouseInside: false,
};
}
componentDidUpdate(prevProps, prevState) {
Object.entries(this.props).forEach(([key, val]) =>
prevProps[key] !== val && console.log(`Prop '${key}' changed`)
);
Object.entries(this.state).forEach(([key, val]) =>
prevState[key] !== val && console.log(`State '${key}' changed`)
);
}
// simple example of using a debounce in a react input component
class Input extends Component {
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
// taken from https://davidwalsh.name/javascript-debounce-function
debounce = (func, wait, immediate) => {
@rmbrntt
rmbrntt / index.js
Created April 29, 2019 14:59 — forked from blairg/index.js
Mock event.preventDefault() with Jest
static async handleDelete(event) {
let success = true;
await Axios.delete('/todos')
.then(() => {})
.catch(error => {
success = false;
console.error(error);
});
function cssToJson(css) {
const json = {};
const rules = css.replace(/\/\*[\s\S]*?\*\//g, '') // remove comments
.split('}');
for (let i = 0; i < rules.length - 1; i++) {
const rule = rules[i].split('{');
const selector = rule[0].trim();
const properties = rule[1].split(';');
const selectorObject = {};
for (let j = 0; j < properties.length - 1; j++) {
@rmbrntt
rmbrntt / extract-js.js
Created March 25, 2023 01:53
JavaScript to extract functions and classes.
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const { parse } = require('@babel/parser');
function extractFunctions(node, filepath, functions) {
if (
(node.type === 'FunctionDeclaration' ||
(node.type === 'VariableDeclarator' && node.init && node.init.type === 'FunctionExpression') ||
@rmbrntt
rmbrntt / macos-tmux-256color.md
Created April 29, 2023 15:19 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):