Skip to content

Instantly share code, notes, and snippets.

@DRN88
DRN88 / easyrsa3-quick-wildcardcert
Last active January 15, 2024 16:54
easyrsa3-quick-wildcardcert
#!/bin/bash
FQDN="domain.local"
CERT_FILENAME="wildcard.${FQDN}"
CERT_COMMONNAME="*.${FQDN}"
wget "https://github.com/OpenVPN/easy-rsa/archive/master.zip"
unzip master.zip
mv easy-rsa-master/easyrsa3/ .
rm -rf master.zip easy-rsa-master/
@DRN88
DRN88 / HowTo Laravel 10 SymfonyMailerHandler Monolog Dependency Injections with Service Container.md
Last active December 22, 2023 13:08
HowTo Laravel 10 SymfonyMailerHandler Monolog Dependency Injections with Service Container

HowTo Laravel 10 SymfonyMailerHandler Monolog Dependency Injections with Service Container

https://laravel.com/docs/10.x/container#binding-primitives

Having issues with php artisan config:cache, saying it's unserializable? Say no more!

  1. Remove any objects from config/logger.php. See below.
  2. Inject mailer dependencies with AppServiceProvider.php
  3. Note: env() variables does not work in AppServiceProvider.php. Define your variables somewhere, then use config() to access them.

$mailer and $email variables are the given class' (defined in when()) constructor arguments.

@DRN88
DRN88 / laravel-alpinejs-blade-template-show-hide-table-row-click-event.blade.php
Last active June 12, 2023 09:00
Laravel AlpineJS Blade template show/hide table row on click event.
//
// This is a blade component which contains 2 <tr> rows. In the first row you click on the product name, the second row should show/hide. (toggle)
// x-cloak will hide <tr> during page load, so it won't "blink".
//
//
@props([
'sku' => null,
'name' => null,
'mpn' => null,
@DRN88
DRN88 / memcached-rpmbuild.sh
Last active March 27, 2023 07:07
Build memcached RPMs on CentOS 7
#!/bin/bash
# Set version
VERSION="1.4.33"
# Dependencies
yum -y install rpmdevtools automake gcc make wget libevent-devel perl-Test-Simple cyrus-sasl-devel
# Create rpmbuild directory structure
rpmdev-setuptree
# Download source
[ ! -f /root/rpmbuild/SOURCES/memcached-${VERSION}.tar.gz ] && wget "http://memcached.org/files/memcached-${VERSION}.tar.gz" -P /root/rpmbuild/SOURCES/
# Build from archive. memcached-1.4.29/memcached.spec
@DRN88
DRN88 / send-aws-sns-sms.sh
Last active January 11, 2023 13:46
Send aws sns sms messages with bash. Zabbix
#!/bin/bash
#
# 1, Create AWS IAM user with a policy allowing only AWS SNS Publish command
# 2, Install awscli with 'yum -y install awscli' on zabbix server
# 3, Add /bin/bash shell for zabbix user: usermod -s /bin/bash zabbix
# 4, Deploy this script to: /etc/zabbix/send-aws-sns-sms.sh
# 5, Edit this script and define the required variables
# 6, Run the script manually to test
# 7, Use the script in Zabbix. Create a new Media Type -> Script
# Use zabbix documentation for the script parameter setup
@DRN88
DRN88 / vmware-vsphere-cli-centos7.sh
Created August 9, 2016 14:14
vmware-vsphere-cli-centos7.sh
#!/bin/bash
# Install required packages
yum makecache all
yum -y install openssl-devel cpan perl-Devel-StackTrace perl-Class-Data-Inheritable perl-Convert-ASN1 perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-X509 perl-Exception-Class perl-Archive-Zip perl-Path-Class perl-Try-Tiny perl-Crypt-SSLeay perl-Class-MethodMaker perl-Data-UUID perl-Data-Dump perl-SOAP-Lite perl-XML-SAX perl-XML-NamespaceSupport perl-libxml-perl perl-XML-LibXML perl-Socket6 perl-IO-Socket-INET6 perl-Net-INET6Glue
# Install perl modules with specific version
PERL_MM_USE_DEFAULT=1 cpan install BINGOS/ExtUtils-MakeMaker-6.96.tar.gz LEONT/Module-Build-0.4205.tar.gz GBARR/libnet-1.22.tar.gz GAAS/libwww-perl-5.837.tar.gz PERLER/UUID-Random-0.04.tar.gz
# Unattended vspherecli install
@DRN88
DRN88 / haproxy-merge-configs.sh
Last active June 9, 2022 22:17
HAProxy main config generator from conf.d configs
#!/bin/bash
#
# 1. Read and validate config files in conf.d folder: NN_configname.conf
# 2. Merge them to '.haproxy-candidate.cfg'
# 3. Validate the candidate config with haproxy
# 4. If the candidate config is valid overwrite haproxy.cfg
#
MAIN_CONFIG="/etc/haproxy/haproxy.cfg"
TEMP_CONFIG="/etc/haproxy/.haproxy-candidate.cfg"
CONFD_DIR="/etc/haproxy/conf.d"
@DRN88
DRN88 / tampermonkey_extract_tradingview_data
Last active November 27, 2021 18:26
Extract tradingview data with tampermonkey script
// ==UserScript==
// @name Extract TradingView Databox on keypress
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.tradingview.com/chart/IQRwR53e/?symbol=USI%3APCC
// @icon https://www.google.com/s2/favicons?domain=tradingview.com
// @grant none
// @run-at document-end
@DRN88
DRN88 / Micropython esp-open-sdk build esp toolchain esp8266 espressif ubuntu 20.04.md
Created August 26, 2021 00:30
Micropython esp-open-sdk build esp toolchain esp8266 espressif ubuntu 20.04
@DRN88
DRN88 / OnePlusOne-LineageOS-17.1
Created August 13, 2020 09:09
OnePlusOne-LineageOS-17.1
Updating everything on OnePlus One (bacon) Windows 10
This will erase ALL your data, so your phone will be completely empty
1. Backup all your stuff, photos, etc.
2. Download latest files to your PC:
* TWRP: https://eu.dl.twrp.me/bacon/
* LineageOS: https://download.lineageos.org/bacon
* Gapps Android 10 ARM PICO version: https://opengapps.org/
* Android platform tools (adb): https://developer.android.com/studio/releases/platform-tools