Skip to content

Instantly share code, notes, and snippets.

View dianjuar's full-sized avatar

Diego Julião dianjuar

View GitHub Profile
@dianjuar
dianjuar / create-months-folder.sh
Created October 22, 2023 18:38
Bash script to create moths of the year in Spanish
mkdir "01 Enero";
mkdir "02 Febrero";
mkdir "03 Marzo";
mkdir "04 Abril";
mkdir "05 Mayo";
mkdir "06 Junio";
mkdir "07 Julio";
mkdir "08 Agosto";
mkdir "09 Septiembre";
mkdir "10 Octubre";
@dianjuar
dianjuar / spawn-async.ts
Created November 15, 2022 05:16
child_process.spawn using promises
import { spawn } from 'child_process';
export function spawnAsync(command: string, args?: string[]): Promise<void> {
return new Promise((resolve, reject) => {
const process = spawn(command, args);
process.stdout.on('data', data => {
console.log(data.toString());
});
process.stderr.on('data', data => {
@dianjuar
dianjuar / fileExists.ts
Created October 19, 2022 05:48
Node function to verify if a file exists
import { promisify } from 'util';
export async function fileExists(path: string): Promise<boolean> {
try {
await promisify(access)(path);
return true;
} catch (err) {
if (isAccessError(err) && err.code === 'ENOENT') {
return false;
}
@dianjuar
dianjuar / connecting-lines.directive.ts
Last active October 7, 2022 17:03
Create connecting lines between boxes with Angular
import {
AfterViewInit,
Directive,
ElementRef,
Inject,
Input,
} from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { MapPathsDirective } from './map-path.directive';
@dianjuar
dianjuar / FadeOnTouch.lua
Last active July 1, 2022 01:32
Roblox Scripts
local platform = script.Parent
local isTouched = false
local function fade(fadeDuration: number, reaperance: number)
local fadeIntervals = 29
local intervalFraction = fadeDuration / fadeIntervals
return function ()
if not isTouched then
@dianjuar
dianjuar / SonarQube dockerized.md
Created February 6, 2022 07:16
Sonarqube dockerized

To init the server

  • npm run sonar:init-server To run the analysis
  • npm run sonar:analysis

To inspect the analysis, go to http://localhost:9000. The credentials are admin and password 12345

@dianjuar
dianjuar / sonarqube-dockerized.sh
Last active November 6, 2021 18:59
How to work with SonarQube in a dockerized way
# Download the image
docker pull sonarqube
docker pull sonarsource/sonar-scanner-cli
# Create the container
docker run --name=sonarqube -p 9000:9000 sonarqube
# Star the stoped container
docker start sonarqube --interactive
@dianjuar
dianjuar / run-any-exec-nx.bash
Created October 20, 2021 05:19
Run any executor on a Nx Workspace:
nx run your-project:executor
@dianjuar
dianjuar / binary-tree.ts
Last active October 10, 2021 01:48
Utils to manage perfect binary trees
import { TreeNode } from './node';
export class PerfectBinaryTree<T> {
/**
* The height or levels the binary tree
*/
private _height: number;
public get height(): number {
return this._height;
}
@dianjuar
dianjuar / check-postgres-extension-and-schema.md
Created September 17, 2021 16:35
Check which extension belongs to which schema

Verify what Postgres extension belongs to what schema

SELECT
    e.extname AS "Name",
    e.extversion AS "Version",
    n.nspname AS "Schema",
    c.description AS "Description" 
FROM pg_catalog.pg_extension e 
LEFT JOIN pg_catalog.pg_namespace n