Skip to content

Instantly share code, notes, and snippets.

View rogeriotaques's full-sized avatar

Rogério Taques rogeriotaques

View GitHub Profile
@rogeriotaques
rogeriotaques / README.md
Last active December 11, 2025 17:22
HestiaCP NginX Templates : Single and multi-tenant NodeJS apps

HestiaCP NginX Templates

Have a VPS running HestiaCP which should run a single or multi tenant Nodejs application? These are the templates that are gonna help you set it up out of the box! These templates were designed to just work, specially if you're running your servers behind CloudFlare.

Installing the templates

Copy these files into /usr/local/hestia/data/templates/web/nginx/, restart Nginx and you should already see the templates listed in the Backend Template option in the Advanced Options on your domain settings page.

Content of this Gist

@rogeriotaques
rogeriotaques / .database-heartbeat.env
Last active October 16, 2025 04:06
MySQL Database Heartbeat Checker with Telegram Notification in PHP
# DATABASE CREDENTIALS
DB_HOST=localhost
DB_USER=YOUR-USER
DB_PASS=YOUR-USER-PASSWORD
DB_NAME=YOUR-DATABASE-NAME # Optional
# TELEGRAM CONFIGURATION
# CREATE YOUR BOT AND GET ITS IDS FROM BotFather ON TELEGRAM
TELEGRAM_CHANNEL_ID=-123...9
TELEGRAM_BOT_TOKEN=7089...4g
@rogeriotaques
rogeriotaques / sec-watcher.php
Last active July 20, 2020 01:43
Security package watcher in PHP
<?php
/**
* This script checks for security updates in the server and
* it's expected to be scheduled for a daily run.
*
* It will notify the $notify address if one or more security
* package updates are found.
*/
<?php
/**
* Echo colored strings in the terminal (PHP-CLI).
* @use Colors::write("hello word!", "green", "light_green");
*/
class Colors
{
/** @var array */
<?php
public function uploadFileFromBlobString($base64string = '', $file_name = '', $folder = '')
{
$file_path = "";
$result = 0;
// Convert blob (base64 string) back to PDF
if (!empty($base64string)) {
$base64data = base64_decode($base64string, true);
@rogeriotaques
rogeriotaques / base64topdf-working.php
Last active October 22, 2024 12:33
Converts base64 string back to a pdf file
<?php
public function uploadFileFromBlobString($base64string = '', $file_name = '', $folder = '')
{
$file_path = "";
$result = 0;
// Convert blob (base64 string) back to PDF
if (!empty($base64string)) {
@rogeriotaques
rogeriotaques / pdf2base64.ts
Last active November 26, 2019 02:19
Converts a PDF file to base64 string.
getFileInfo(evt: any): void {
const reader: FileReader = new FileReader();
const files: Array<any> = evt.target.files || evt.dataTransfer.files;
reader.addEventListener(
'load',
() => {
this.form.file_path = reader.result;
},
false
@rogeriotaques
rogeriotaques / .eslintrc
Created April 19, 2018 05:08
Standard ESLint configuration file I am using in my projects with jQuery and Gulp.
{
"env": {
"browser": true,
"node": true,
"jquery": true
},
"extends": ["airbnb-base"],
"rules": {
"arrow-parens": ["error", "always"],
"camelcase": "off",