Skip to content

Instantly share code, notes, and snippets.

View Icaruk's full-sized avatar
Magic

Icaruk Icaruk

Magic
View GitHub Profile
# Set layout to spanish
$LanguageList = New-WinUserLanguageList es-ES
Set-WinUILanguageOverride -Language $LanguageList
Set-WinUserLanguageList $LanguageList -Force
Set-WinDefaultInputMethodOverride -InputTip "0409:0000040A"
Write-Output "Done"
@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
}
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 / 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"
@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;
};
});
// -----------------
// router.js
// -----------------
// URL: backend.com/uno?id=111
app.get("/uno", controllerUno);
// URL: backend.com/dos
// BODY: {id: 222}
// 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%"
}
}
/**
* Devuelve la profundidad de un pozo a partir del tiempo tanscurrido entre soltar una piedra y escuchar su sonido.
* La piedra se deja caer, no se tira.
*
* @param {number} segundos Número de segundos desde que sueltas la piedra hasta que escuchas el sonido.
* @return {number} Profundidad del pozo en metros.
*/
const alturaPozo = (segundos) => {