Skip to content

Instantly share code, notes, and snippets.

slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr /skms kms.nbk.ngtech.co.il
slmgr /ato
slmgr /xpr
slmgr /dli
{
if ( ([ /interface/lte/monitor lte1 once as-value ]->"functionality") = "full" ) do={
if ( ([ /interface/lte/monitor lte1 once as-value ]->"access-technology") = "LTE" ) do={
:log info "LTE Connection";
if ( ([ /interface/lte/monitor lte1 once as-value ]->"rsrp") < -95 ) do={
:log info "Low LTE reception";
} else={
:log info "HIGH LTE reception";
}
} else={
$path = "C:\Users\eliez"
### First give system permissions
$identity = "SYSTEM"
$acl = Get-Acl -Path $path
$ace = New-Object System.Security.Accesscontrol.FileSystemAccessRule ($identity, "FullControl", "Allow")
$acl.AddAccessRule($ace)
Set-Acl -Path $path -AclObject $acl
#!/usr/bin/env sh
IPVERSION="$1"
INTERFACE="$2"
case ${IPVERSION} in
4|v4|ipv4|ip4|6|v6|ipv6|ip6)
;;
*)
echo "Missing ip version to remove: 4 or 6"
exit 1
{
:local BridgeName "switch1"
/interface bridge add name=$BridgeName
:for LoopCount from=1 to=24 do={
:put "working on: ether$LoopCount";
/interface bridge port add bridge=$BridgeName interface="ether$LoopCount"
}
}
#!/usr/bin/env sh
apk update
apk add openvswitch openvswitch-bash-completion bash bash-completion openvswitch-doc openvswitch-openrc vim tcpdump ruby ruby-rdoc git
sed -i -e "s@mouse\=a@mouse=r@g" /usr/share/vim/vim*/defaults.vim
grep "mouse=a" /usr/share/vim/vim*/defaults.vim
grep "auto switch0" /etc/network/interfaces >/dev/null
RES="$?"
@elico
elico / email-backup.rsc.j2
Created June 14, 2024 13:35
a simple backup script for RouterOS V7.x
{
:do {
:log info "STARTING BACKUP";
:global customerIdentificationVar;
:local customerIdentification "{{ customer_identifictation }}";
if ( [:len $customerIdentificationVar] > 0 ) do={
:set customerIdentification "$customerIdentificationVar";
@elico
elico / send-backup-to-server.rsc
Created June 10, 2024 23:02
Send a rsc backup to a server over a POST request.
{
/export show-sensitive file=routeros-generic-config.rsc;
:local deviceSerialNumber "1234";
:local apiUsername "$deviceSerialNumber";
:local apiPassword "secretPassword";
:lcal backupServerDomain "cep-backup.ngtech.home"
:local fileContent [/file get routeros-generic-config.rsc contents];
:local apiUrl "https://$backupServerDomain/api/v1/backup/$apiUsename/generic";
:local postData "$fileContent";
:local contentLength [:len $fileContent];
@elico
elico / Prefer-Wifi-Connections.ps1
Created June 5, 2024 21:30
Powershell Scripts to change the interfaces preference to WIFI and another to reset which will probably prefer the ethernet
# Get the network interfaces
$interfaces = Get-NetIPInterface | Where-Object {$_.InterfaceAlias -eq "Wi-Fi" -or $_.InterfaceAlias -eq "Ethernet"}
# Set a higher metric value for the Ethernet interface
foreach ($interface in $interfaces) {
if ($interface.InterfaceAlias -eq "Ethernet") {
Set-NetIPInterface -InterfaceAlias $interface.InterfaceAlias -InterfaceMetric 100
} else {
Set-NetIPInterface -InterfaceAlias $interface.InterfaceAlias -InterfaceMetric 10
}
@elico
elico / set-mgmnt-dhcp-client.ps1
Created June 5, 2024 20:56
Set a static address on a specific interface with specific ip string prefix
# Variables
$ipStringPrefix = "192.20.20." # Replace with the desired IP address prefix
$newIpAddress = "192.20.20.150" # Replace with the desired new static IP address
$newPrefixLength = 24 # Replace with the desired subnet mask length
# Find the interface by CIDR
$interfaces = Get-NetIPAddress | Where-Object {
$_.IPAddress.StartsWith($ipStringPrefix)
}