Skip to content

Instantly share code, notes, and snippets.

View rchuluc's full-sized avatar
💻

Rafael Chuluc rchuluc

💻
  • Wura.io
  • Campinas/Brazil
View GitHub Profile
openssl genrsa 2048 > private.pem
openssl req -x509 -new -key private.pem -out public.pem
openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx
@rchuluc
rchuluc / sidebar.tsx
Created February 13, 2025 13:24 — forked from ercnshngit/sidebar.tsx
Shadcn multi sidebar support in sidebar.tsx
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { VariantProps, cva } from "class-variance-authority"
import { PanelLeft } from "lucide-react"
import { useIsMobile } from "@/hooks/use-mobile"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Separator } from "@/components/ui/separator"
@rchuluc
rchuluc / 1_ecs_note.md
Created November 6, 2024 12:06 — forked from ejlp12/1_ecs_note.md
ECS Best Practices Notes
@rchuluc
rchuluc / node-ts-hello-adventures.md
Created April 30, 2024 20:53 — forked from rsp/node-ts-hello-adventures.md
Creating and using a Node library with TypeScript

node-ts-hello adventures

This is what I was really doing while creating an example from this answer on Stack Overflow:

It turned out that I made several stupid mistakes and wasted a lot more time than it might look like from reading the answer. I eventually removed from the answer not so much out of embarrassment but because I didn't want to be accused that I am complicating the process on purpose to make Deno look better in comparison. The truth is that below ius exactly what I did while trying to create and publish a new module on npm written in TypeScript and use it with ts-node later:

https://github.com/rsp/node-ts-hello

@rchuluc
rchuluc / pagination.decorator.ts
Created November 24, 2023 19:47
Pagination decorator for NestJS
import { ExecutionContext, createParamDecorator } from '@nestjs/common';
import { ApiQuery } from '@nestjs/swagger';
export interface IPagination {
page: number;
limit: number;
}
export interface IPaginationResponse<T> {
items: T[];
@rchuluc
rchuluc / Heroku SSL with Certbot.md
Created June 23, 2022 00:21 — forked from Jlevyd15/Heroku SSL with Certbot.md
Creating a SSL certificate locally using Certbot on Mac OS and deploying to an existing Heroku App

Creating a SSL certificate locally using Certbot on Mac OS and deploying to an existing Heroku App

Caveats

  • You must have a heroku app deployed on the hobby tier. This is NOT the free tier and costs ~7/month
  • i'm assuming you have homebrew installed. It will be need to install the Certbot client
  • i'm also assuming you have the heroku CLI tools installed

first up, run this to install the certbot client

brew install certbot
@rchuluc
rchuluc / add-update-github-access-token-on-mac.md
Created December 3, 2021 23:12 — forked from jonjack/add-update-refresh-github-access-token-on-mac.md
Adding & Updating GitHub Access Token on Mac

As outlined here, there are a couple of situations where you may want/need to authenticate with GitHub by using an Access Token:-

  1. If you have Two-Factor Authentication (2FA) enabled.
  2. You are accessing an organisations protected content using SAML Single-Sign On (SSO).

Using an Access Token for the first time

Create an Access Token

In your GitHub account, go to Settings / Developer settings / Personal access tokens and select Generate New Token. Make a note of the token somewhere safe since this is the only chance you get to see it.

@rchuluc
rchuluc / encryption.js
Created October 22, 2021 17:22 — forked from vlucas/encryption.ts
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@rchuluc
rchuluc / reset.js
Created October 24, 2020 14:23 — forked from 19h/reset.js
Node.js — Clear Terminal / Console. Reset to initial state.
console.reset = function () {
return process.stdout.write('\033c');
}