Skip to content

Instantly share code, notes, and snippets.

View qoomon's full-sized avatar
🌳
Go for it.

Bengt Brodersen qoomon

🌳
Go for it.
View GitHub Profile
@qoomon
qoomon / bypass safe links.user.js
Last active March 22, 2023 14:45
Userscript to bypass Safe Links
@qoomon
qoomon / Colima-status.2s.zsh
Created February 13, 2023 16:44
xBar - Colima Status
#!/bin/zsh
# <xbar.title>Colima Status</xbar.title>
# <xbar.author>Bengt Brodersen</xbar.author>
# <xbar.author.github>qoomon</xbar.author.github>
# <xbar.desc>Displays Colima Status - https://github.com/abiosoft/colima</xbar.desc>
source ~/.zprofile
DOCKER_RUNNING_ICON='iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACqgAwAEAAAAAQAAACoAAAAAxiJEngAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0Y
@qoomon
qoomon / script.sh
Last active February 9, 2023 16:13
Google Drive - Hide Symbolic Link in Home Directory
# lock and hide Google Drive link
chflags -h uchg,hidden "$HOME/Google Drive"
# undo by following command
# chflags -h nouchg,nohidden "$HOME/Google Drive"
@qoomon
qoomon / jira-queries.md
Last active February 7, 2023 09:21
Jira Queries

Board Quick Filters

  • Recently Updated

    • updatedDate >= -1d OR ( updatedDate <= endOfWeek(-1w) AND updatedDate >= -3d)
      • Filter issues updated since last weekday
  • Flagged

    • Flagged is not EMPTY
  • Flter flagged issues

@qoomon
qoomon / template.plugin.zsh
Created February 7, 2023 08:25
ZSH Plugin File Template
#!/bin/zsh
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
echo "${${0:A}/%.plugin.zsh/.zsh}"
@qoomon
qoomon / parse-body.js
Created October 25, 2022 14:38
Parse http.IncomingMessage body
async function parseBody(res) {
return new Promise((resolve, reject) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => resolve(body));
}).then(body => res.body = body ? JSON.parse(body) : undefined);
}
@qoomon
qoomon / base-vpc.ts
Created September 30, 2022 14:32
AWS CDK - Vpn Construct - Configure default security group according to "CIS AWS Foundations Benchmark controls",
import {Stack} from "aws-cdk-lib";
import {Vpc, VpcProps} from "aws-cdk-lib/aws-ec2";
import {AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId} from "aws-cdk-lib/custom-resources";
import {Construct} from "constructs";
export class BaseVpc extends Vpc {
constructor(scope: Construct, id: string, props: VpcProps) {
super(scope, id, props);
// Configure default security group according to "CIS AWS Foundations Benchmark controls",
// section "4.3 – Ensure the default security group of every VPC restricts all traffic".
@qoomon
qoomon / iptables-local-port-forward.sh
Last active August 15, 2022 20:21
iptables - forward traffic from local port to target address
#!/usr/bin/env bash
set -o errexit # exit when a command line fails
set -o pipefail # pipes exit code will be the last non-zero exit code of all pipe commands
set -o nounset # exit on read a undeclared variable
#set -o xtrace # enable debug logging
cd "$(dirname "${BASH_SOURCE[0]}")"
# systemctl enable iptables.service
# Target Address e.g '123.123.123.123:1024'
@qoomon
qoomon / GitHubBulkOperations.sh
Created July 29, 2022 11:11
GitHub Bulk Operations
# list repos
# gh repo list $owner --json nameWithOwner -q '.[].nameWithOwner'
repos=(
example/example
)
for repo in "${repos[@]}"
do
echo $repo
@qoomon
qoomon / .gitlab-ci.yml
Last active July 20, 2022 23:18
GitLab CI - build and push docker image to GitLab registry
stages:
- pack
### Pack ######################################################################
docker:
stage: pack
environment: production
image: docker:18
script: