Skip to content

Instantly share code, notes, and snippets.

Avatar

Arthur Corenzan haggen

View GitHub Profile
@haggen
haggen / README.md
Last active May 29, 2021
Linux setup
View README.md

My Linux setup

  1. Update everything

    sudo bash -c 'apt update; apt upgrade -y'
    
  2. Drivers

  3. Git, vim, zsh, build-essential (or equivalent)

    sudo apt install git vim zsh build-essential curl 
    
@haggen
haggen / .zshrc
Last active May 1, 2021
Starship prompt config
View .zshrc
# Source zprezto
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# startship prompt
# https://starship.rs/
eval "$(starship init zsh)"
# setup asdf
@haggen
haggen / less.js
Created Mar 5, 2021
Next.js v9/v10 integration for LESS leveraging built-in support for SASS
View less.js
const cloneDeep = require("clone-deep");
const { readFileSync, existsSync } = require("fs");
const path = require("path");
// next-less (official plugin to integrate Less) is now
// deprecated so we have to provide our own solution.
//
// Next.js already provides built-in integration with CSS and Sass, but it
// relies on a dynamic WebPack config. generation to do it optimally.
//
@haggen
haggen / use-local-stored-state.ts
Created Jun 12, 2020
TypeScript Local Storage backed state hook for React
View use-local-stored-state.ts
import { useState, useEffect } from "react";
type Serializable =
| null
| boolean
| number
| string
| Date
| { toJSON(): string }
| Serializable[]
@haggen
haggen / setup.sh
Last active Apr 14, 2020
Setup my shell.
View setup.sh
!#/usr/bin/env bash
set -ue
# Setup vim.
# https://github.com/amix/vimrc
#
if ! test -d $HOME/.vim_runtime; then
git clone --depth=1 https://github.com/amix/vimrc.git $HOME/.vim_runtime
sh ~/.vim_runtime/install_basic_vimrc.sh
@haggen
haggen / Jason.yaml
Created Apr 10, 2020
EVE Online overview.
View Jason.yaml
backgroundOrder:
- 13
- 44
- 52
- 11
- 51
- 50
- 9
- 12
- 14
@haggen
haggen / importjson.gs
Created Mar 24, 2020
Simple IMPORTJSON function for Google Sheets.
View importjson.gs
/**
* Import data from a remote JSON document.
*
* @param {url} URL of the JSON document
* @param {path} dot notation path to the value you want to extract
*
* @return a single value extracted from the JSON.
*
* @customfunction
*/
@haggen
haggen / script.sh
Created Mar 21, 2020
Local DNS with dnsmasq on Ubuntu 18 (bionic)
View script.sh
#!/bin/usr/env bash
set -ue
# Need sudo.
test $(id -u) -eq 0 || { sudo $0; exit 0; }
# Free up port 53
systemctl stop systemd-resolved
systemctl disabled systemd-resolved
@haggen
haggen / id_rsa.pub
Created Mar 20, 2020
My public key.
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyGNCdo+LfOlbm+PfJZu9iAlTn6gKZMqVra/nx/IG6wFY8Cm+Zs/RlFVTCl9HHtOyCcyeEeUnwPfA2WrYR9smjs+gUZIKRE6leiOxMZXYl+QPE462EhZgKN8Nbiv2fabXIjhCnrphC8OZq7Lub246pe/zO+CSZOZWblUqwuh9XidGQttB3c/FQdj3qo9+gK6wg7xlekujTPTxaCnYislaPPX2iIxXZfQmrVnrWGnGGdQMuFDtrE41tQEVc/shI0mP5ciSH2H8uc79cg7RB54aGZQtW91Ka+Yjs+4Fi8DsplT7O1WN5yD9q7grd+1zhFilHCDxP2XaRPY+P4+4OQFoX arthur@corenzan.com
@haggen
haggen / randomize-id.sh
Created Mar 17, 2020
Randomize id attributes in a svg (or other markup)
View randomize-id.sh
#!/bin/bash
set -euo pipefail
help() {
cat <<-EOF >&2
Usage:
$0 [-h|-v|-i ...] <path>
Options: