Skip to content

Instantly share code, notes, and snippets.

View tecfu's full-sized avatar

Tec Fu tecfu

  • Tec Fu
View GitHub Profile
@tecfu
tecfu / fzgrep
Created July 13, 2023 05:24 — forked from TripleDogDare/fzgrep
An interactive fuzzy grep showing surrounding context
#!/bin/bash
set -euo pipefail
# go get github.com/junegunn/fzf
BEFORE=10
AFTER=10
HEIGHT=$(expr $BEFORE + $AFTER + 3 ) # 2 lines for the preview box and 1 extra line fore the match
PREVIEW="$@ 2>&1 | grep --color=always -B${BEFORE} -A${AFTER} -F -- {}"
@tecfu
tecfu / nvme_mount.md
Created August 14, 2021 20:56 — forked from a-maumau/nvme_mount.md
how to mount m.2 ssd/hdd
@tecfu
tecfu / abilities.js
Created August 29, 2019 23:02 — forked from stalniy/abilities.js
CASL Vue routes
import { AbilityBuilder, Ability } from 'casl'
// Alternatively this data can be retrieved from server
export default function defineAbilitiesFor(user) {
const { rules, can } = AbilityBuilder.extract()
can('read', 'User')
can('update', 'User', { id: user.id })
if (user.role === 'doctor') {
@tecfu
tecfu / docker-wordpress.sh
Created July 24, 2017 04:47 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb: