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
#!/usr/bin/env python3
import subprocess
command = "ps axo user:30,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm"
l = subprocess.check_output(["/bin/bash", "-c", command]).decode("utf-8").split("\n")
minlen = sorted(set([30-len(item.split(" ")[0]) for item in l]))[0]
for line in l:
print(line[:30-minlen]+line[30:])
{
:local iname "ether1-WAN"
:local rate [/interface monitor-traffic $iname once as-value]
:local raterx ($rate->"rx-bits-per-second")
:local ratetx ($rate->"tx-bits-per-second")
:local type [:toarray "bps,Kbps,Mbps,Gbps"]
:local counter 0
:if ([/ping 8.8.8.8 count=10 size=64 interval=2s]=0) do={
:log warning "LTE DOWN";
/interface disable lte1
:delay 5
/interface enable lte1
}
# mengaktifkan fitur docker pd mikrotik, akan diminta tekan tombol mode. lalu router reboot
/system/device-mode/update container=yes
# mempersiapkan ip yg akan dipakai docker
/interface veth add address=192.168.2.28/27 gateway=192.168.2.1 name=linux
# gabung ke bridge LAN yg sdh ada
/interface bridge port add bridge=bridge-LAN interface=linux
[Interface]
PrivateKey = RandomPrivateKey
Address = IPV4
Address = IPV6
DNS = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
MTU = 1280
[Peer]
PublicKey = RandomPublicKey
AllowedIPs = 0.0.0.0/0
AllowedIPs = 2000::/3
{
:put "List user yg sedang tidak login :"
:foreach i in=[/ppp secret find] do={
:local username [/ppp secret get $i name]
:local hitung [:len [/ppp active find where name=$username]]
:if ( $hitung = 0 ) do={
:put "$username"
}
:foreach i in=[/system scheduler find] do={
:local nama [/system scheduler get $i name]
:local duplikat "dup_$nama"
/system scheduler add copy-from=$nama name=$duplikat
/system scheduler remove [find name=$nama]
/system scheduler set [find name=$duplikat] name=$nama
}
@kangarie
kangarie / list file with duration
Created January 4, 2023 02:53
list movies file on a folder with movie duration
for i in ./*.mkv
do
a=`ffmpeg -hide_banner -i $i 2>&1 | grep Duration | cut -d ',' -f1`
b=$i
echo $a $b
done
{
:local seed ([/certificate scep-server otp generate minutes-valid=0 as-value]->"password")
:local angka 0
:local char
:for i from=1 to=([:len $seed]-1) do={
:set char [:tonum [:pick $seed $i]]
:if ( $char > 0 ) do= {
#include <stdio.h>
int main(void)
{
int n,i,j,x;
printf("Enter an integer: ");
scanf("%d", &n);
for(i=1;i<=n;i++) {