Skip to content

Instantly share code, notes, and snippets.

@raditotev
raditotev / gist:706d644ec49da54e36cbc5533eba799d
Created June 28, 2024 20:07
Verify file signature (Mac/Linux)
gpg --import publickey.asc
gpg --verify filePGPSignature.asc filename
// Get completed tickets where a user changed the status to REVIEW (i.e. completed tickets by a given user)
project = XXX AND status was "To Do" AND status = Done AND status changed TO REVIEW BY 62cbffb38afb5805e5d3b51a
@raditotev
raditotev / gist:88a56ced96db29b04f240b8e596b6393
Created January 3, 2023 14:29
Read/ write files using base64 encoding
const file = fs.readFileSync(path.join(__dirname, 'sample.pdf'), { encoding: 'base64' })
fs.writeFileSync('path/to/where/file/will/be/saved', file, 'base64')
@raditotev
raditotev / node-express-multer-diskStorage-firebase.js
Last active January 13, 2022 17:24
Uploading files to Firebase/ Storage using Nodejs, express and multer with diskStorage as storage option
const fs = require('fs/promises');
const express = require('express');
const morgan = require('morgan');
const cors = require('cors');
const createError = require('http-errors');
const bodyParser = require('body-parser');
const { initializeApp } = require('firebase/app');
const {
getStorage,
ref,
@raditotev
raditotev / node-express-multer-memoryStorage-firebase.js
Last active January 13, 2022 17:24
Uploading files to Firebase/ Storage using Nodejs, express and multer with memoryStorage as storage option
const express = require('express');
const morgan = require('morgan');
const cors = require('cors');
const createError = require('http-errors');
const bodyParser = require('body-parser');
const { initializeApp } = require('firebase/app');
const {
getStorage,
ref,
uploadBytes,
@raditotev
raditotev / mongo-mongoose.md
Created January 9, 2022 09:05
Step by step guide to connecting and interacting with mongo db

Mongo, Mongoose

  • Install mongoose - npm install mongoose
  • Create connection in app.js using your db credentials
// app.js
const mongoose = require('mongoose');

mongoose
@raditotev
raditotev / express-app.md
Last active January 9, 2022 11:55
Step by step basic set up for an express app

Building REST API with Node

  • Create project folder and run npm -y init to set up package.json

  • Optional: Set up git git init

  • Install express - npm i express

  • Create app.js in the root of the project

  • Paste following in the same file

    // app.js
git rebase --interactive 'bbc643cd^' #include carret ^ at the end to rebase to the commit before the one to edit
# In the default editor, modify pick to edit in the line mentioning 'bbc643cd'.
# Rebase will stop at the requested commit, i.e. bbc643cd
# Make and stage changes
git commit --amend # or git commit --amend -m "an updated commit message" if you want to change message too
git rebase --continue # this will apply the rest of the commits and bring you to HEAD
# WARNING: Note that this will change the SHA-1 of that commit as well as all children
# https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit
@raditotev
raditotev / console_log_colours
Last active July 14, 2020 11:00
Console log colours
console.log("\x1b[33m%s\x1b[0m" ,"I Am Using Yellow");
console.log("\x1b[44m%s\x1b[0m" ,"Background Color Is Blue");
echo -e "\033[31mText will be red for this message\033[0m"
Reset = "\x1b[0m"
Bright = "\x1b[1m"
Dim = "\x1b[2m"
Underscore = "\x1b[4m"
Blink = "\x1b[5m"
Reverse = "\x1b[7m"