This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisites: | |
# [GNU Parallel](https://www.gnu.org/software/parallel/) | |
# [kubectl-neat](https://github.com/itaysk/kubectl-neat) | |
# [mikefarah/yq](https://github.com/mikefarah/yq) | |
# | |
# Usage: | |
# - Copy and paste the below into your active shell session. Alternatively, add to your shell initialization scripts. | |
# - kubectl_export <namespace> | |
# The folder structure will be created: <namespace>/<kind>/<resource_name>.yaml | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrape from 'website-scraper'; | |
import TurndownService from 'turndown'; | |
import { JSDOM } from 'jsdom'; | |
import path from 'path'; | |
import fs from 'fs-extra'; | |
const turndownService = new TurndownService(); | |
class MyPlugin { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function () { | |
main(); | |
function extractText(element) { | |
if (element.nodeType === Node.TEXT_NODE) { | |
return element.textContent.trim() + ' '; | |
} | |
if (element.nodeType !== Node.ELEMENT_NODE) { | |
return ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use this to send and receive files | |
# Dependencies: | |
# SSH-Keys setup for root users. I recommend using agent forwarding for this. | |
# mbuffer installed in /opt/local/bin/mbuffer. Adjust to reality. | |
# | |
# This script presumes: | |
# zsnapper is installed. Comment out the two lines where it is referenced if you don't use it | |
DATE=$(date +%Y%m%d%H%M) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It should go without saying, but make sure your terraform file is checked into version control before running this. | |
# If you find a bug, please let me know =) | |
# Add quotation marks | |
elixir -e 'Enum.each(Path.wildcard("**/*.tf"), fn filename -> File.read!(filename) |> String.split("\n") |> Enum.map(fn line -> arraylist = line |> String.trim() |> String.split(" ") |> Enum.map(fn s -> to_charlist(s) end); case arraylist do; [a, b, c, [123]] when a in [[114,101,115,111,117,114,99,101], [100,97,116,97], [112,114,111,118,105,100,101,114], [98,97,99,107,101,110,100]] -> [a,32,34,b,34,32,34,c,34,32,123,10]; _ -> line <> "\n"; end; end) |> to_string() |> String.trim() |> (&(File.write!(filename, &1))).() end)' | |
# Remove quotation marks from "resource", "data", "provider", and "backend" lines | |
elixir -e 'Enum.each(Path.wildcard("**/*.tf"), fn filename -> File.read!(filename) |> String.split("\n") |> Enum.map(fn line -> arraylist = line |> String.trim() |> String.split(" ") |> Enum.map(fn s -> to_charlist(s) end); cas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependabot auto-approve | |
on: pull_request_target | |
permissions: | |
pull-requests: write | |
# From the docs at https://github.com/dependabot/fetch-metadata#enabling-auto-merge | |
jobs: | |
dependabot: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
tmux new-session -d -s multiplex | |
tmux select-window -t multiplex:0 | |
INDEX=0 | |
for i in alice bob charles denice ephrahim fantasea greg | |
do | |
tmux split-window -h | |
tmux select-pane -t $INDEX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add Terraform Plan to Pull Requests | |
on: | |
pull_request: | |
env: | |
# See page below about disabling Hashicorp Upgrade and Security Checks | |
# https://www.terraform.io/docs/commands/index.html#upgrade-and-security-bulletin-checks | |
CHECKPOINT_DISABLE: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -rcolorize -rnet/http -e ' | |
def check() | |
s_time = Time.now() | |
res = Net::HTTP.get_response(URI( "https://example.com/")) | |
ensure | |
e_time = Time.now() | |
code = defined?(res.code) ? res.code : "5xx" | |
return [e_time - s_time, code] | |
end | |
while true do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu -o pipefail | |
[[ $(w | wc -l) -lt 3 ]] && { | |
echo "Nobody logged in" | |
sudo shutdown -hP +60 "Shutting down due to no active sessions" | |
} || { | |
echo "Users logged in" >/dev/null | |
} |
NewerOlder