Skip to content

Instantly share code, notes, and snippets.

@agriffis
agriffis / system.js
Created Apr 26, 2021
Custom xstyled re-exports
View system.js
import * as R from 'ramda'
import scStyled from 'styled-components'
import * as xstyled from '@xstyled/styled-components'
import {
css,
defaultTheme,
Preflight,
style,
ThemeProvider,
useTheme,
@agriffis
agriffis / proxy.pac
Created Feb 2, 2021
proxy.pac for debugging
View proxy.pac
function FindProxyForURL(url, host) {
return "DIRECT";
}
@agriffis
agriffis / useForceRender.js
Last active Jun 27, 2020
usePromises React hook
View useForceRender.js
import React from 'react'
/**
* React hook to force a re-render, for hooks with fancy state management.
*/
export const useForceRender = () => {
const [, emit] = React.useState()
// Stable function response, like useCallback without checking.
return React.useRef(() => {
@agriffis
agriffis / 0_sched.py
Last active Apr 22, 2019
RIPUL 2019 scheduling
View 0_sched.py
#!/usr/bin/env python3
from collections import defaultdict, namedtuple
import functools
from pprint import pformat, pprint
import sys
Y = 2019
N = 16
@agriffis
agriffis / .vimrc
Created Feb 25, 2019
neovim clipboard provider for tmux and OSC 52
View .vimrc
function! ClipboardCopy(lines, regtype)
let sum = TryClipboardCmd('md5sum', a:lines)
call writefile(sum, s:regtype_sum, 'S')
call writefile([a:regtype], s:regtype_txt, 'S')
return TryClipboardCmd('clipboard-provider copy', a:lines)
endfunction
function! ClipboardPaste()
let lines = TryClipboardCmd('clipboard-provider paste')
let regtype = 'V'
View smartctl.txt
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.16.5-300.fc28.x86_64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Number: INTEL SSDPEKKW512G8
Serial Number: BTHH807007N4512D
View journalctl -b -k
-- Logs begin at Sat 2018-05-05 08:59:40 EDT, end at Sat 2018-05-05 09:38:54 EDT. --
May 05 09:36:22 localhost.localdomain kernel: Linux version 4.16.5-300.fc28.x86_64 (mockbuild@bkernel02.phx2.fedoraproject.org) (gcc version 8.0.1 20180324 (Red Hat 8.0.1-0.20) (GCC)) #1 SMP Fri Apr 27 17:38:36 UTC 2018
May 05 09:36:22 localhost.localdomain kernel: Command line: BOOT_IMAGE=/vmlinuz-4.16.5-300.fc28.x86_64 root=/dev/mapper/fedora_windows--obdemh7-root ro resume=/dev/mapper/fedora_windows--obdemh7-swap rd.lvm.lv=fedora_windows-obdemh7/root rd.lvm.lv=fedora_windows-obdemh7/swap rhgb quiet LANG=en_US.UTF-8
May 05 09:36:22 localhost.localdomain kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
May 05 09:36:22 localhost.localdomain kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
May 05 09:36:22 localhost.localdomain kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
May 05 09:36:22 localhost.localdomain kernel: x86/fpu: Supporting XSAVE feature 0x008: 'MPX
View ps1.md

Out of the box, the new prompt depends on Nerd Fonts. Personally I'm using "DejaVuSansMono Nerd Font Complete." There are a couple ways around this if you'd rather: use fontconfig to merge Nerd symbols with your preferred font, see here and here; or you can override the various PS1_CHAR_* variables after loading .bashrc.prompt to use symbols already present in your font.

@agriffis
agriffis / chr
Last active Mar 13, 2018
chrome os startup
View chr
#!/bin/bash
#
# chr -- wrapper for enter-chroot to run setup after reboot
#
set -e
main() {
declare name
case $1 in
@agriffis
agriffis / .vimrc
Created Mar 2, 2018
EnableBracketedPaste
View .vimrc
function! EnableBracketedPaste()
" Enable bracketed paste everywhere. This would happen automatically on
" local terms, even with mosh using TERM=xterm*, but doesn't happen
" automatically in tmux with TERM=screen*. Setting it manually works fine.
if ! has("gui_running") && exists('&t_BE') && &t_BE == ''
let &t_BE = "\e[?2004h" " enable
let &t_BD = "\e[?2004l" " disable
let &t_PS = "\e[200~" " start
let &t_PE = "\e[201~" " end
endif