Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# test -f /root/wakeup.sh && exit 0
uci batch <<EOF
set system.@system[0].hostname='WR703N'
set system.@system[0].conloglevel=8
set system.@system[0].cronloglevel=8
set system.@system[0].timezone=HKT-8
set system.@system[0].zonename='Asia/Hong Kong'
@brianonn
brianonn / pandoc.css
Created September 14, 2024 23:25 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@brianonn
brianonn / github-pandoc.css
Created September 14, 2024 23:24 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@brianonn
brianonn / AuthyToOtherAuthenticator.md
Last active January 9, 2024 23:03 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


*update: This might affect how easy it is to use this technique past August 2024: https://www.theverge.com/2024/1/8/24030477/authy-desktop-app-shutting-down


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

@brianonn
brianonn / enable_aspm.sh
Created December 30, 2023 02:38
Enable ASPM on pcie devices if the BIOS did not turn it on
#!/bin/bash
# Copyright (c) 2010 Luis R. Rodriguez <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@brianonn
brianonn / xmonad.hs
Created October 6, 2023 04:51
A sample xmonad config file that has layouts for borderless fullscreen mode -- Use this for a reference for my own xmonad
------------------------------------------------------------------------
-- import
------------------------------------------------------------------------
--
-- from Stackoverflow https://unix.stackexchange.com/a/698139
--
import XMonad hiding ( (|||) ) -- jump to layout
import XMonad.Config.Desktop
import qualified XMonad.StackSet as W
import System.Exit
@brianonn
brianonn / main.tf
Created March 12, 2023 10:48
main.tf for use with localstack running on localhost port
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
required_version = "~> 1.0"
}
@brianonn
brianonn / aws-describe-instances.sh
Created March 12, 2023 10:43
describe instances in AWS with a nice table output
#!/bin/sh
## -----------------------------------------------------------------------
## | DescribeInstances |
## +-----------------+-----------------------+-------------+-------------+
## | IP Address | Instance ID | Name | State |
## +-----------------+-----------------------+-------------+-------------+
## | 10.66.122.61 | i-e947af0a891355efc | Server 002 | terminated |
## | 10.163.29.52 | i-828f336627c36ba76 | Server 001 | terminated |
## | 10.222.236.205 | i-60cef875d3e88c7a5 | Server 001 | terminated |
@brianonn
brianonn / nsenter-node.sh
Created January 18, 2023 09:30
get a shell on a kubernetes node using just the nodename
#!/bin/sh
set -x
node=${1}
nodeName=$(kubectl get node ${node} -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
nodeSelector='"nodeSelector": { "kubernetes.io/hostname": "'${nodeName:?}'" },'
podName=${USER}-nsenter-${node}
kubectl run ${podName:?} --restart=Never -it --rm --image overriden --overrides '
{
@brianonn
brianonn / README.md
Last active December 24, 2022 14:18
for telmate/proxmox provider: extract host IPs from terraform.tfstate file after hosts are created

Extract hosts inventory file for Ansible

This script is intended to be used with the Telmate terraform provider for Proxmox

Requirements

  • Telmate terraform provider installed via terraform init
  • must use tags = "server" or tags = "worker" when defining server and worker VM's in the terraform provider
  • have a successfull terraform apply that created the terraform.tfstate file
  • Ansible installed
  • jq installed