Skip to content

Instantly share code, notes, and snippets.

View sistematico's full-sized avatar
🏠
Working from home

Lucas Saliés Brum sistematico

🏠
Working from home
View GitHub Profile
@ThimoDEV
ThimoDEV / clear-planetscale-db-drizzle.ts
Created November 6, 2023 09:59
A simple script to clear all the data of your planetscale DB (force-reset from PrismaORM)
// db.ts
import * as schema from "./schema"
export const db = drizzle(connection, { schema })
//reset.ts
async function reset() {
const tableSchema = db._.schema
if (!tableSchema) {
throw new Error("No table schema found")
@ysc3839
ysc3839 / README.md
Last active January 3, 2024 14:26
Systemd timer for lego

Systemd timer for lego

Place lego.service and lego.service in /etc/systemd/system. Place config in /var/lib/lego and nginx-example.com.sh in /var/lib/lego/scripts. You should modify config and nginx-example.com.sh. Finally execute sudo systemctl enable lego.timer.

Lego's files are stored in /var/lib/lego. You need to create this directory and use lego ... run to create acme account.

I'm using DNS challenge and didn't test HTTP challenge. Please tell me if it works.

@emersonbroga
emersonbroga / JsonHelper.js
Created September 30, 2021 02:48
Json Helper
const fs = require('fs');
const JSONWrite = (filePath, data, encoding = 'utf-8') => {
const promiseCallback = (resolve, reject) => {
fs.writeFile(filePath, JSON.stringify(data, null, 2), encoding, (err) => {
if (err) {
reject(err);
return;
}
resolve(true);
@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active April 30, 2024 07:36
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

diff --git a/config.def.h b/config.def.h
index 1c0b587..12a99d7 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,8 +1,15 @@
/* See LICENSE file for copyright and license details. */
+#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
+
/* appearance */
diff --git a/config.def.h b/config.def.h
index 1c0b587..73da874 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,10 +12,12 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const char col_red[] = "#ff0000";
static const char *colors[][3] = {
@uelsson
uelsson / files.js
Last active April 24, 2023 11:29
Node.js - Como listar arquivos com fs, path
// Vídeo do código: https://youtu.be/Eeqyi6W4CqY
const fs = require('fs');
const path = require('path');
var raiz = './arquivos';
var data = {};
var aux = 0;
function listarArquivos(base) {
@datatypevoid
datatypevoid / getMoonPhase.ts
Last active September 11, 2022 15:42 — forked from endel/getMoonPhase.js
Get moon phase by Date, written in TypeScript. Accurate from year 1900 to 2199 inclusive.
export { EMoonPhase, EMoonPhaseName, MOON_PHASE_NAMES, moonPhase }
const { round, trunc: truncate } = Math
enum EMoonPhase {
New = 0,
WaxingCrescent,
[
{
"value": 1,
"first": "bar",
"second": "bar",
"third": "bar"
},
{
"value": 2,
"first": "grape",