Skip to content

Instantly share code, notes, and snippets.

View azec-pdx's full-sized avatar
💻
DevOps & many other things ...

Amer Zec azec-pdx

💻
DevOps & many other things ...
View GitHub Profile
@azec-pdx
azec-pdx / gist:0663529ec796c961e23fa87f6fe2681b
Created October 31, 2023 15:44 — forked from remen/gist:31e798670783261c8a93
Run shell command in groovy
/**
* Runs commands using /bin/sh and returns stdout as string
*
* <p>
* If the exit code of the command is non-zero, the stderr of the command is printed to stderr
* and a RuntimeException will be thrown.
* </p>
* <b>Example</b>
* <pre><code>
* def files = sh('ls $HOME').split()
@azec-pdx
azec-pdx / proton_opn_wg.md
Created February 8, 2023 04:48 — forked from morningreis/proton_opn_wg.md
OPNsense + ProtonVPN + Wireguard Configuration Guide

OPNsense + ProtonVPN + Wireguard

Published: 16 December 2022

Reference: https://docs.opnsense.org/manual/how-tos/wireguard-selective-routing.html

Goal: Set up one or more Wireguard connections from ProtonVPN on OPNsense, with policy based routing, and optional Killswitch.

I'm writing this guide first as a reference for my future self for when I inevitably forget how to do this, but also to help others out. I found there were not many guides on this specific configuration, particularly not with multiple concurrent connections, and these were some steps which were not at all obvious. I did begin with the guide in the official OPNsense documentation, but even that was missing info to make ProtonVPN work. If you are a pfSense user, it is very similar to OPNsense, and you should be able to follow along with some success, but I have not tested it myself.

@azec-pdx
azec-pdx / bash_strict_mode.md
Created April 20, 2022 23:17 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@azec-pdx
azec-pdx / gist:d8192932d33fe97bc656cde1b5cc3f13
Created April 5, 2021 19:33 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@azec-pdx
azec-pdx / rot13Reader.go
Created September 19, 2020 00:32
Implements A Tour of Golang challenge https://tour.golang.org/methods/23
package main
import (
"io"
"os"
"strings"
)
var rot13Lookup = map[byte]byte{ // All are ASCII (UTF-8) so safe to use 1 byte for representation of code point
'A': 'N', 'B': 'O', 'C': 'P', 'D': 'Q', 'E': 'R', 'F': 'S', 'G': 'T', 'H': 'U', 'I': 'V', 'J': 'W', 'K': 'X', 'L': 'Y', 'M': 'Z', 'N': 'A', 'O': 'B', 'P': 'C', 'Q': 'D', 'R': 'E', 'S': 'F', 'T': 'G', 'U': 'H', 'V': 'I', 'W': 'J', 'X': 'K', 'Y': 'L', 'Z': 'M', 'a': 'n', 'b': 'o', 'c': 'p', 'd': 'q', 'e': 'r', 'f': 's', 'g': 't', 'h': 'u', 'i': 'v', 'j': 'w', 'k': 'x', 'l': 'y', 'm': 'z', 'n': 'a', 'o': 'b', 'p': 'c', 'q': 'd', 'r': 'e', 's': 'f', 't': 'g', 'u': 'h', 'v': 'i', 'w': 'j', 'x': 'k', 'y': 'l', 'z': 'm',
@azec-pdx
azec-pdx / mongo-ls.js
Last active May 13, 2019 21:27 — forked from matteofigus/mongo-ls.js
A script to list all the collections and document count for a specific mongodb db
// Usage: mongo {Server without mongodb:// example 127.0.0.1:27017}/{DbName} [-u {Username}] [-p {Password}] < ./mongo-ls.js
var collections = db.getCollectionNames();
print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system')
print(name + ' - ' + db[name].count() + ' records');
@azec-pdx
azec-pdx / keybase.md
Created March 14, 2019 06:14
Verification of GitHub on Keybase

Keybase proof

I hereby claim:

  • I am azec-pdx on github.
  • I am azec (https://keybase.io/azec) on keybase.
  • I have a public key ASCSUYLpN0gGf0PxqNGiXlbvBV_74ZOGmuh46rUvbx3-ogo

To claim this, I am signing this object:

https://veneur.org/
https://github.com/segmentio/ecs-logs
https://github.com/segmentio/cwlogs
https://www.loggly.com/blog/why-journald/
https://docs.docker.com/config/containers/logging/journald/
https://github.com/iovisor/bcc
https://github.com/segmentio/pprof-server
https://github.com/segment-boneyard/ecs-host-manager
@azec-pdx
azec-pdx / README.md
Created June 23, 2017 17:43 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@azec-pdx
azec-pdx / blastRefresh.js
Created January 6, 2016 00:27
CRM refresh form and alert when field changed
var originalBlastStatus = null;
function SaveAndRefresh() {
//Xrm.Page.getAttribute("myAttributeName").setValue(null);
//Xrm.Page.data.refresh(true);
originalBlastStatus = Xrm.Page.getAttribute("new_campaign_status").getText();
checkStatusChanged();
}
var checkStatusChanged = function () {