Skip to content

Instantly share code, notes, and snippets.

View kangarie's full-sized avatar
💭
vpn remote by tunnel.my.id

KangArie kangarie

💭
vpn remote by tunnel.my.id
View GitHub Profile
@kangarie
kangarie / mikrotik_watchdog_vpn.txt
Last active January 26, 2023 16:04
Mikrotik scheduler script to check connection by ping, restart when ping timeout
# isi dgn nama interface
:local interface "ovpn-client"
# isi dgn ip netwatch
:local ip "192.168.195.1"
:if ([/ping $ip count=5] = 0) do {
:log warning "Interface $interface is restarting"
/interface disable $interface
:delay 1
@kangarie
kangarie / vpndns.txt
Created September 23, 2022 12:02
Mikrotik script to add dns over vpn
# skrip otomatis hapus jika ada settingan lama
/tool netwatch remove [find comment="MyTunnel-DNS"]
/ip firewall nat remove [find comment="MyTunnel-DNS"]
/ip firewall mangle remove [find comment="MyTunnel-DNS"]
/ip route remove [find comment="MyTunnel-DNS"]
/interface ovpn-client remove [find comment="MyTunnel-DNS"]
/interface sstp-client remove [find comment="MyTunnel-DNS"]
/interface l2tp-client remove [find comment="MyTunnel-DNS"]
/interface pptp-client remove [find comment="MyTunnel-DNS"]
@kangarie
kangarie / segitiga.php
Created September 23, 2022 12:08
PHP script to draw a triangle of wildcard
<?php
$n = 5;
for($i=1;$i<=$n;$i++) {
for($j=1;$j<=$i;$j++) echo "*";
echo "\n";
}
/*
@kangarie
kangarie / make_swap.sh
Created September 23, 2022 12:13
Bash script to create swap file
dd if=/dev/zero of=/swapfile bs=2048 count=524288
chmod 0600 /swapfile
chown root:root /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
@kangarie
kangarie / set_timezone.sh
Created September 23, 2022 12:15
Command to change to Linux time zone of Jakarta
ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
@kangarie
kangarie / mikrotik_watchdog_dns.txt
Last active January 26, 2023 16:04
Mikrotik scheduler script to check AdGuardHome availability, by resolving to AGH server then change DNS if AGH is not resolving
:local curDNS [/ip dns get server]
:local gwDNS "192.168.2.1"
:local aghDNS "172.17.0.99"
:local aghDNS "192.168.2.66"
:local oriDNS "8.8.8.8,8.8.4.4"
:local testDomain "www.google.com"
:local isDown "no"
:if ($curDNS = $aghDNS) do={
@kangarie
kangarie / mikrotik_dhcp_queue_lease_hostname
Last active September 13, 2023 09:59
Mikrotik DHCP server script to update queue comment based on host name
:local namahost $"lease-hostname"
:local status
:local pesan
:if ($leaseBound = 0) do={ :set status "Logout" } else={ :set status "Login" }
:set pesan "$status - $leaseServerName - $leaseActIP - $namahost"
:log warning "$pesan"
:if ($leaseBound = 0) do={
@kangarie
kangarie / queue_delete
Created September 23, 2022 12:35
Mikrotik script to delete pppoe dynamic queue created by hotspot
/queue simple remove [find dynamic=yes name~"pppoe-"]
@kangarie
kangarie / mikrotik_container_adguardhome.txt
Last active March 24, 2024 13:27
mikrotik container adguard home script installation
/system/device-mode/update container=yes
/interface veth add address=172.17.0.1/24 gateway=172.17.0.254 name=agh
/interface bridge add name=dockers
/interface bridge port add bridge=dockers interface=agh
/ip address add address=172.17.0.254/24 interface=dockers network=172.17.0.0
/ip firewall nat add action=masquerade chain=srcnat
/container config set registry-url=https://registry-1.docker.io tmpdir=/disk1/tmp
#include <stdio.h>
int main(void)
{
int n,i,j,x;
printf("Enter an integer: ");
scanf("%d", &n);
for(i=1;i<=n;i++) {