Skip to content

Instantly share code, notes, and snippets.

View broilogabriel's full-sized avatar
:shipit:

Gabriel Broilo Luz broilogabriel

:shipit:
View GitHub Profile
@broilogabriel
broilogabriel / dynamic_args.sh
Last active July 5, 2022 09:47
Snippet for shell script with named arguments
#!/bin/bash
# FROM https://unix.stackexchange.com/a/388038
while [ $# -gt 0 ]; do
if [[ $1 == *"--"* ]]; then
v="${1/--/}"
declare $v="$2"
fi
shift
@broilogabriel
broilogabriel / epoch.sh
Created November 26, 2020 15:48
Simple function to convert timestamp or timeuuid to human readable date
#!/bin/bash
function epoch() {
number='^[0-9]{13}$'
uuid='^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$'
if [[ "$1" =~ $number ]]; then
TS=$1
elif [[ "$1" =~ $uuid ]]; then
strdate="$(uuid -d $1 | grep 'time:' | awk '{print $3,$4}' | cut -c1-26)"
TS=$(($(date -d "$strdate" +"%s%N") / 1000000))
else
@broilogabriel
broilogabriel / wsl2.md
Created July 7, 2020 12:27 — forked from rfaita/wsl2.md
Installing WSL2 on Windows 10

Install and configure WSL2 on windows 10

Install WSL2

Using the following link here install the WSL 2 on your windows 10.

Install X-Server

VcXsrv seems to the best choice for X-Server in Windows

@broilogabriel
broilogabriel / netExtender.md
Last active March 12, 2020 18:51 — forked from youribonnaffe/netExtender Ubuntu install and service
netExtender Ubuntu 14.04 Install and run as a service
@broilogabriel
broilogabriel / netextender
Created March 12, 2020 17:32
upstart init.d script for running Dell SonicWALL NetExtender as a service. Script should be in /etc/init.d/netextender Configuration goes in /etc/default/netextender Than run: sudo update-rc.d netextender defaults
#!/bin/sh
# defaults for NetExtender Dell VPN Client
# sourced by /etc/init.d/netextender
# should be placed in /etc/default/netextender
# Enable or disable the daemon
ENABLE_DAEMON=1
# Path to daemon
DAEMON=/usr/sbin/netExtender
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
const express = require('express')
const puppeteer = require('puppeteer');
// var path = require('path');
// var cookieParser = require('cookie-parser');
const app = express()
const port = 30000
// app.use(logger('dev'));
app.use(express.json());
#!/usr/bin/env bash
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
#!/bin/sh
# Execute with:
# wget -O - https://gist.githubusercontent.com/broilogabriel/0e317752c7912e490c04c93cba45e2af/raw/node_exporter.sh | sh
sudo apt-mark hold node-exporter && \
wget https://github.com/prometheus/node_exporter/releases/download/v0.15.2/node_exporter-0.15.2.linux-amd64.tar.gz -P /tmp/ && \
tar -zxvf /tmp/node_exporter-0.15.2.linux-amd64.tar.gz --wildcards -C /tmp/ node_exporter-*/node_exporter --strip-components=1 && \
sudo cp /usr/sbin/node_exporter /usr/sbin/node_exporter.bkp && \
sudo chmod -x /usr/sbin/node_exporter.bkp && \