echo 3 > /proc/sys/vm/drop_caches
Wednesday, April 28, 2021
Sunday, April 18, 2021
Python Random Function
import math
import random
import string
def generate_random_digit(length):
digits = "0123456789"
otp = ""
for i in range(length):
otp += digits[math.floor(random.random() * 10)]
print(otp)
def generate_random(length):
print(string.ascii_uppercase)
print(string.ascii_lowercase)
print(string.ascii_letters)
print(string.digits)
print(''.join(random.choices(string.digits, k=length)))
print(''.join(random.choices(string.ascii_letters+string.digits, k=length)))
print(''.join(random.choices(string.ascii_uppercase+string.digits, k=length)))
generate_random_digit(8)
generate_random(10)
Monday, February 22, 2021
Tuesday, February 9, 2021
Error getting keypair for CA issuer: certificate is not a CA
edit file /etc/ssl/openssl.cnf
[ v3_ca ]
basicConstraints = critical,CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
generate csr with option -extensions v3_ca
ex.
openssl req \
-x509 \
-new \
-nodes \
-key private/univ-ca.key.pem \
-sha256 \
-days 1825 \
-out certs/univ-ca.cert.pem \
-subj '/C=TH/O=YOU-ORG-NAME/emailAddress=YOU_EMAIL' \
-passin pass:$CA_PASS \
-extensions v3_c
Monday, December 21, 2020
How to access from local network in WSL2
add port:
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=172.20.216.249
delete port:
netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=0.0.0.0
show port:
netsh interface portproxy show all
ex.
PS C:\Windows\system32> netsh interface portproxy show all
Listen on ipv4: Connect to ipv4:
Address Port Address Port
--------------- ---------- --------------- ----------
0.0.0.0 3000 172.20.216.249 3000
0.0.0.0 8080 172.20.216.249 8080
Monday, December 7, 2020
PowerShell Connections for Office365 Administrators
Office 365/Azure AD
Microsoft Online Services Sign-in Assistant for IT Professionals
PS C:\>Install-Module MSOnline
PS C:\>$credential = Get-Credential
PS C:\>Connect-MsolService -Credential $Credential
Azure AD
PS C:\>Install-Module AzureAD
PS C:\>Connect-AzureAD
Exchange Online
PS C:\>$credential = Get-Credential
PS C:\>$exosession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid -Credential $credential -Authentication Basic –AllowRedirection
PS C:\>Import-PSSession $exosession
Microsoft Teams
PS C:\>Install-Module -Name MicrosoftTeams
PS C:\>Install-Module -Name MicrosoftTeams -AllowClobber
PS C:\>Connect-MicrosoftTeams
Skype for Business Online
Skype for Business Online PowerShell Module
PS C:\>$credential = Get-Credential
PS C:\>$skypesession = New-CsOnlineSession -Credential $credential
PS C:\>Import-PSSession $skypesession
SharePoint Online
SharePoint Online Management Shell
PS C:\>$Credential = Get-Credential
PS C:\>Connect-SPOService -url https://yourtenantname-admin.sharepoint.com -Credential $credential
ex. Connect-SPOService -url https://my365-admin.sharepoint.com -Credential $credential
PS C:\>Get-Command -Noun SPO*
Security and Compliance Center
PS C:\>$credential = Get-Credential
PS C:\>$ccsession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $Credential -Authentication Basic -AllowRedirection
PS C:\>Import-PSSession $ccsession
Tuesday, November 24, 2020
Error opening specified endpoint "udp:127.0.0.1:161" (net-snmp) ALPINE LINUX
Error opening specified endpoint "udp:127.0.0.1:161" (net-snmp) ALPINE LINUX
#vi /etc/snmp/snmpd.conf
agentAddress SERVER_IP_ADDRESS
or
#vi /etc/snmp/snmpd.conf
agentAddress udp:161
#rc-update add snmpd default
#/etc/init.d/snmpd start
ALCATEL 6900
write memory copy running certified reload from working no rollback-timeout
-
SET LLDP System NAME: system name ALL-Uplink system location SIAM-FL11 SHOW LLDP Configure: show lldp config or show lldp local-syste...
-
grant execute on utl_http to wc grant execute on dbms_lock to wc; BEGIN DBMS_NETWORK_ACL_ADMIN.create_acl ( acl => ...
-
:system view system-view or sys :show all config dis current-configuration :create vlan vlan vlan_number :show ip interface ...