Skip to content

Instantly share code, notes, and snippets.

cmdkey /generic:TERMSRV/192.168.1.100 /user:owner /pass:test1234
@elico
elico / allow-icmpv4-windows.bat
Created November 7, 2024 15:45
Allow ICMPv4 ping on Windows 10 /11 firewall
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow
rem "Win server 2022 standard VDYBN-27WPP-V4HQT-9VMD4-VMK7H"
rem "Win server 2022 DC WX4NM-KYWYW-QJJR4-XV3QB-6VM33"
rem "Windows 10/11 pro W269N-WFGWX-YVC9B-4J6C9-T83GX"
rem "Windows 10/11 pro for workstation NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J"
slmgr /ipk NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J
slmgr /skms kms.internal.ip-com.co.il
{
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];