Skip to content

Instantly share code, notes, and snippets.

@Joaquim3
Joaquim3 / fncGeneratePwd.js
Created August 3, 2024 10:58
JAVASCRIPT ⇢ generate a password with 11 characters
//--------------------------------------------------
// purpose : generate a password with 11 characters
// return a string
//--------------------------------------------------
function fncGeneratePwd() {
const sCharSymbols = "+=?!@#$%*"; // you can add more symbols
const sCharDigits = "0123456789";
const sCharUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const sCharLower = "abcdefghijklmnopqrstuvwxyz";
@Joaquim3
Joaquim3 / fncFormatDate.js
Created August 3, 2024 10:26
JAVASCRIPT ⇢ retrieve a date with a specific format
//----------------------------------------------------------
// purpose : retreive a date with a specific format
// example = 31-01-2024 01:27:55
//----------------------------------------------------------
function fncFormatDate() {
let currentDatetime = new Date();
let formattedDate = fncaddLeadingZeros(currentDatetime.getDate()) + "-" +
fncaddLeadingZeros(currentDatetime.getMonth() + 1) + "-" +
currentDatetime.getFullYear() + " " +
fncaddLeadingZeros(currentDatetime.getHours()) + ":" +
@Joaquim3
Joaquim3 / only2digitsafter1dot.html
Created July 30, 2024 11:50
JAVASCRIPT ⇢ check for only digits, only 1 dot, only 2 digits after dot
<!DOCTYPE html>
<html>
<head>
<script>
function isnumber (elem) {
k = elem.value;
// check for only digits
// check for only 1 dot
// check for only 2 digits after dot
@Joaquim3
Joaquim3 / usermanagement.ps1
Created July 28, 2024 12:41
POWERSHELL ⇢ Create New Local User with credentials ⇢ Adds it to a Group ⇢ Creates and Shares its Folder
#------------------------------------------------------
# This Creates New Local User with credentials ⇢ Adds it to a Group ⇢ Creates and Shares its Folder
#------------------------------------------------------
#------------------------------------------------------
# Get Random String
#------------------------------------------------------
Function Get-RandomAlphanumericString {
[CmdletBinding()]
@Joaquim3
Joaquim3 / fncSendEmail.ps1
Created July 28, 2024 11:37
POWERSHELL ⇢ Sends an email
#-----------------------------------------------------------
# purpose : sends an email
# variables : $body
# $Subject
# $email
# $From
# $SMTP
# $myPassword
# just adapt to your credentials
#-----------------------------------------------------------
@Joaquim3
Joaquim3 / passwordsha512.ps1
Created July 28, 2024 11:17
POWERSHELL ⇢ generate random password ⇢ generate salt ⇢ Encrypt password with salt
#--------------------------------------------------------------------
# purpose : 1. generate random password
# 2. generate salt
# 3. Encrypt password with salt
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# purpose : generate a ComputeHash
# params : anystring
@Joaquim3
Joaquim3 / fncDeleteOldFiles.ps1
Created July 28, 2024 11:08
POWERSHELL ⇢ Delete all Files in specific folders older than 14 days
#--------------------------------------------------------------------
# purpose : Delete all Files in specific folders older than 14 days
# params : $sDirToCheck
#--------------------------------------------------------------------
Function fncDeleteOldBackups([String] $sDirToCheck)
{
$Daysback = "-14"
$CurrentDate = Get-Date
$DatetoDelete = $CurrentDate.AddDays($Daysback)
@Joaquim3
Joaquim3 / forceonedrive.ps1
Created July 28, 2024 11:06
POWERSHELL ⇢ Force accounts to be linked to Onedrive
#------------------------------------------------------------------------------
# Purpose : By using this script, you avoid having to use the forms from GPEDIT.MSC manually
# Usage : This forces windows users to autoconnect to Onedrive and be linked.
#
# Required : OneDrive must be installed before using this.
# : An ENTRA-INTUNE administrator Account Office 365 (professional / school) must first be SET on Windows, before using this.
#
# Run as administrator
# info : Users are still able to disable synchronization of some folders.
# source : https://admx.help/?Category=Windows_10_2016&Language=en-us
@Joaquim3
Joaquim3 / fncCheckBelgianRegistryNumber.php
Created July 22, 2024 17:52
PHP -> Check if National Belgian Registry Number is Correct
<?php
//------------------------------------------------------------------------
// purpose : this is used to check if a Belgian person's national registry number is correct
// params : $sNumber (11 digits) example 84102512345
// $sTmpYear (4 digits) exemple : 1984
// output : true/false
//------------------------------------------------------------------------
function fncCheckBelgianRegistryNumber($sNumber, $sTmpYear) {
@Joaquim3
Joaquim3 / rustdesk.sh
Created July 22, 2024 14:40
SH -> restart rustdesk service and app after having selected a Network
#!/bin/bash
#---------------------------------------------------------------
# -> filename : rustdesk.sh
# -> sudo chmod u+x rustdesk.sh
# -> Usage : ./rustdesk.sh
#
# This tool implies, that you have set multiple RustDesk Servers.
#
# change : xxx.xxx.xxx.xxx by your first network