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
Apache deny access IPs
Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from 192.168.1.0/24
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
Delete DfrsPrivate folder
md d:\empty
Robocopy.exe d:\empty "D:\System Volume Information\dfsr\Private" /purge
rd d:\empty
I found that at:
https://superuser.com/questions/78434/how-to-delete-directories-with-path-names-too-long-for-normal-delete
Robocopy.exe d:\empty "D:\System Volume Information\dfsr\Private" /purge
rd d:\empty
I found that at:
https://superuser.com/questions/78434/how-to-delete-directories-with-path-names-too-long-for-normal-delete
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
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
$@
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.
Assinar:
Postagens (Atom)
Updatable objects appear as 'no longer supported'
Symptoms In some scenarios, the following validation warning appears on an updatable object: " Object is no longer supported. Enforci...
Mais vistos
-
Java Keytool Command These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. A...
-
Kaspersky seems to be storing windows update files on the C Drive: Here -> C:\ProgramData\KasperskyLab\adminkit\1093\.working Change fo...
-
This particular error is generally experienced when people attempt a non NTFS volume such as ReFS to a DFSR replication group as documented...