Javascript format date time

var today = new Date();
var dd = today.getDate();

var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
var hh = today.getHours();
var ii = today.getMinutes();
var ss = today.getSeconds();

if(dd<10)
{
    dd='0'+dd;
}

if(mm<10)
{
    mm='0'+mm;
}
today = yyyy+'-'+mm+'-'+dd+' '+hh+':'+ii+':'+ss;

console.log(today);
today = mm+'/'+dd+'/'+yyyy;
console.log(today);
today = dd+'-'+mm+'-'+yyyy;
console.log(today);
today = dd+'/'+mm+'/'+yyyy;
console.log(today);

source: https://www.w3resource.com/javascript-exercises/javascript-basic-exercise-3.php

List Windows AD active users



Get-ADUser -LDAPFilter "(&(sAMAccountName=*)(!userAccountControl:1.2.840.113556.1.4.803:=2))" ` -Properties sAMAccountName, givenName, sn, mail, enabled | Select sAMAccountName, givenName, sn, mail, enabled | ` Export-Csv -Path c:\Users.csv -NoTypeInformation


Shell script input trick

In the occasion where you are not sure how long the user input might be and you want to capture it all, you would use $@ instead. In the following example, I took in the entire string and print it out word by word after breaking them into a string array according to the spaces in between.

In script run_this.sh:

userInputs=($@)
for i in "${userInputs[@]}";; do
  echo "$i"
done

Running the command:

./run_this.sh who knows how long this can go
who
knows
how
long
this
can
go



source: https://medium.freecodecamp.org/functional-and-flexible-shell-scripting-tricks-a2d693be2dd4


Running command at start up with crontab


    Running crontab -e will allow you to edit your cron.

    Adding a line like this to it:

    @reboot /path/to/script

    will execute that script once your computer boots up.


Mobile Access SSL Network Extender (SNX) remote users with Windows 11 24H2 fail to connect

  Cause The conflict resolution mechanism in Windows 11 24H2 is different than in earlier versions of Windows. Solution On the Windows endpo...

Mais vistos