Skip to content

Instantly share code, notes, and snippets.

View Icaruk's full-sized avatar
Magic

Icaruk Icaruk

Magic
View GitHub Profile
@Icaruk
Icaruk / multipleGitProfiles.md
Last active May 9, 2024 19:45
How to have multiple profiles on git

Last update: 30-01-2024
Last view: 30-01-2024

Step 1

Go to your work folder, mine is located at: F:/Work/EnterpriseName/

And then create a .gitconfig-work with the following data:

@Icaruk
Icaruk / getMousePosition.ps1
Created May 22, 2022 22:14
Prints mouse coordinates every X seconds
$Interval = Read-Host -Prompt 'Write time interval in seconds. Default is 1 second'
if ($Interval -le 0) {
$Interval = 1
}
if ($Interval -lt 0.25) {
$Interval = 0.25
}
@Icaruk
Icaruk / mongo_dump_restore.txt
Last active March 16, 2022 11:51
mongodump + mongorestore
// dump
mongodump --uri="mongodb://localhost:27017/dbName" --gzip --excludeCollection="collName" --archive="./dump"
// restore
mongorestore --uri="mongodb://localhost:27017/dbName" --gzip --drop --archive="./dump"
Write-Host "Shutdown timer..."
$Horas = Read-Host -Prompt 'Hours (can be 0)'
$Minutos = Read-Host -Prompt 'Minutes'
$Segundos = 0
if ($Horas -eq 0) {
$Horas = 0
@Icaruk
Icaruk / Global.code-snippets.json
Created February 16, 2022 11:12
VSC Snippets
{
"LOG": {
"prefix": ["cl", "clog", "log"],
"body": ["console.log( ${1:string} );"]
},
"LOG $": {
"prefix": ["clf", "logf"],
"body": ["console.log ( `${1:Texto} \\${${2:123}\\}` );"]
},
"LOG DEBUG": {
@Icaruk
Icaruk / question.js
Last active August 3, 2021 10:33
Node console question
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
async function doQuestion(question) {
const response = await new Promise( resolve => {
rl.question(question, (data) => {
@Icaruk
Icaruk / MobxStore.js
Created June 7, 2021 10:10
MobX persist localStorage
import { makeAutoObservable } from "mobx";
import persist from "./persist";
export default class UserStore {
constructor() {
makeAutoObservable(this);
@Icaruk
Icaruk / getIPv4.js
Created April 7, 2021 06:39
Gets the IPv4
const networkInterfaces = require("os").networkInterfaces();
let IPv4;
Object.keys(networkInterfaces).forEach( device => {
networkInterfaces[device].forEach((details) => {
if (details.family === "IPv4" && details.internal === false) {
IPv4 = details.address;
};
});
// package.json
{
"scripts": {
"devToMaster": "git checkout dev && git pull && git checkout master && git pull && git merge dev && git push && git checkout dev",
"mergeTo": "git checkout %npm_config_from% && git pull && git checkout %npm_config_to% && git pull && git merge %npm_config_from% && git push && git checkout %npm_config_from%"
}
}
// -----------------
// router.js
// -----------------
// URL: backend.com/uno?id=111
app.get("/uno", controllerUno);
// URL: backend.com/dos
// BODY: {id: 222}