Skip to content

Instantly share code, notes, and snippets.

View gjbianco's full-sized avatar

Guy Bianco IV gjbianco

View GitHub Profile
@gjbianco
gjbianco / bgm.sh
Created August 26, 2024 19:42
background music script
#!/bin/sh
synthwave='https://youtube.com/watch?v=4xDzrJKXOOY'
postrock='https://www.youtube.com/watch?v=MRhplCpkPKE'
[ "$1" == "s" ] && selected=$synthwave
[ "$1" == "r" ] && selected=$postrock
[ -z "$1" ] && selected=$synthwave
mpv --no-resume-playback $selected &>/dev/null & disown;
#!/bin/bash
cat <<EOF
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Guy's Too Read</title>
<link>example.com</link>
<description>a too-read Guy's to-read list</description>
EOF
<!doctype html>
<html>
<head>
<title>beef converter</title>
<meta name="viewport" content="width=device-width" />
</head>
<body>
<h1>beef converter</h1>
<p>"translates" phrase to hexadecimal (invalid letters removed)</p>
<input type="text" id="phrase" placeholder="Input a phrase" />
@gjbianco
gjbianco / bs.js
Last active February 9, 2024 01:38
// based on https://github.com/mourner/bullshit.js
// run via node.js
//
// example: $ cat some-bs.txt | node bs.js
const terms = [
"(business|client|community|culture|customer|data|goal|intelligence|market" +
"|process|quality|results|role|sales|subject|service|user)" +
".(centric(ity)?|facing|oriented|driven|focused|assessment|service|process|align(ed|ment|ing))",
"10x",
@gjbianco
gjbianco / sample-node-app.yaml
Created June 9, 2023 17:13
Batteries-included set of manifests for deploying a hello world Node.js application utilizing OCP builds and routes.
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: node-server
spec:
source:
type: Dockerfile
dockerfile: |
FROM registry.access.redhat.com/ubi8/nodejs-16:latest
@gjbianco
gjbianco / .github-workflows-hugo.yml
Created February 12, 2021 20:22
hugo + asciidoc + gh-page + gh-actions
name: hugo
on:
push:
branches:
- master # Set a branch to deploy
jobs:
deploy:
runs-on: ubuntu-18.04
@gjbianco
gjbianco / bash2fish.md
Created January 16, 2020 20:18
bash --> fish

Regular bash scripts can be used in fish shell just as scripts written in any language with proper shebang or explicitly using the interpreter (i.e. using bash script.sh). However, many utilities, such as virtualenv, modify the shell environment and need to be sourced, and therefore cannot be used in fish. Sometimes, counterparts (such as the excellent virtualfish) are created, but that's often not the case.

Bass is created to make it possible to use bash uilities in fish shell without any modification. It works by capturing what environment variables are modified by the utility of interest, and replay the changes in fish.

You might not need Bass for simple use cases. A great simple alternative (suggested by @jorgebucaran) is to just use

exec bash -c "source some-bash-setup.sh; exec fish"

(originally taken from https://github.com/edc/bass)

#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
#!/usr/bin/env python3
# based on https://stackoverflow.com/a/17992126/117471
import sys
from getpass import getpass
from passlib.hash import sha512_crypt
passwd = input() if not sys.stdin.isatty() else getpass()
print(sha512_crypt.encrypt(passwd))
autocmd FileType yaml setlocal ai sw=2 ts=2 et