Skip to content

Instantly share code, notes, and snippets.

View dbhagen's full-sized avatar

Daniel Hagen dbhagen

View GitHub Profile
@dbhagen
dbhagen / .block
Created June 26, 2023 14:50 — forked from curran/.block
Persons of Concern StreamGraph by Origin
license: mit
border: no
@maoosi
maoosi / amplifyauth-scheme.ts
Last active October 26, 2021 18:24
[WIP] Custom amplify auth scheme for nuxt/auth (auth.nuxtjs.org).
import { Amplify, Auth, withSSRContext } from 'aws-amplify'
import { Auth as NuxtAuth } from '@nuxtjs/auth-next'
export interface AmplifyAuthSchemeOptions {
name: string
}
export default class AmplifyAuthScheme {
public $auth: NuxtAuth
public options: AmplifyAuthSchemeOptions
@laggardkernel
laggardkernel / chpwd-equivalent-in-bash.md
Last active April 7, 2024 11:03
Create chpwd Equivalent Hook in Bash #bash #hook #zsh

There's not a complete hook system designed in Bash when compared with other modern shells. PROMPT_COMMAND variable is used as a hook in Bash, which is equivalent to precmd hook in ZSH, fish_prompt in Fish. For the time being, ZSH is the only shell I've known that has a chpwd hook builtin.

PROMPT_COMMAND

If set, the value is interpreted as a command to execute before the printing of each primary prompt ($PS1).

https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-Variables

chpwd Hook in Bash

@legowerewolf
legowerewolf / hyperstart.bat
Last active December 29, 2023 16:45
Selecting a shell on startup in the Hyper terminal emulator
@ECHO off
:top
CLS
ECHO Choose a shell:
ECHO [1] cmd
ECHO [2] bash
ECHO [3] PowerShell
ECHO [4] Python
ECHO.
ECHO [5] restart elevated
@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@curran
curran / .block
Last active June 26, 2023 14:50
Persons of Concern StreamGraph by Origin
license: mit
border: no
@kacchan822
kacchan822 / softethervpn_letsencrypt_cert_autoupdate.sh
Last active March 26, 2021 17:22
softethervpn_letsencrypt_cert_autoupdate.sh
#!/bin/bash
#
# Copyright (c) 2016 Katsuya SAITO
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# @(#) softethervpn_letsencrypt_cert_autoupdate.sh ver.0.1.0 2016.02.20
#
# Usage: softethervpn_letsencrypt_cert_autoupdate.sh CommonName WEBROOT PASSWORD MAIL
#