Skip to content

Instantly share code, notes, and snippets.

@yenleidong
yenleidong / gist:be678080078d24bebce2
Created December 11, 2014 17:35
Blogger, Put ALL External To Target_Blank
<!-- ALL External To _Blank, Put on above </head> -->
<script type='text/javascript'>
$(document).ready(function() {
$("a[href^='http://']").each(
function(){
if(this.href.indexOf(location.hostname) == -1) {
$(this).attr('target', '_blank');
}
}
);
@yenleidong
yenleidong / gist:32119aae58d399523934
Last active August 29, 2015 14:10
Mark Packet Ping dan DNS
#Lokal 192.168.8.0/24
/ ip firewall mangle
add action=mark-connection chain=prerouting comment="--> ping" \
new-connection-mark=icmp-c protocol=icmp src-address=192.168.8.0/24
add action=mark-packet chain=prerouting connection-mark=icmp-c \
new-packet-mark=icmp-p
add action=change-dscp chain=prerouting packet-mark=icmp-p
add action=mark-connection chain=prerouting comment="--> dns" dst-port=53 \
new-connection-mark=dns-c protocol=tcp src-address=192.168.8.0/24
add action=mark-connection chain=prerouting dst-port=53 new-connection-mark=\
@yenleidong
yenleidong / gist:b3a08e8e62b866e022b2
Created November 20, 2014 05:52
masquerade_2wan
/ip fi nat
add action=masquerade chain=srcnat out-interface=ether1
add action=masquerade chain=srcnat out-interface=ether2
/ip route
add check-gateway=ping dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=route-to-isp1 distance=1
add check-gateway=ping dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=route-to-isp1 distance=2
add check-gateway=ping dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=route-to-isp2 distance=1
add check-gateway=ping dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=route-to-isp2 distance=2
@yenleidong
yenleidong / gist:23988568bb20fc285719
Created November 20, 2014 05:03
Mikrotik_Dual ISP
/ip fi mangle
add action=mark-connection chain=input comment=LB disabled=no dst-address-list=\
!speedy2 in-interface=ether1 new-connection-mark=speedy1_conn \
passthrough=yes src-address-type=""
add action=mark-connection chain=input disabled=no dst-address-list=!speedy1 \
dst-address-type="" in-interface=ether2 new-connection-mark=\
speedy2_conn passthrough=yes
add action=mark-routing chain=output connection-mark=speedy2_conn disabled=no \
new-routing-mark=to_speedy2 passthrough=yes
@yenleidong
yenleidong / gist:eb476ddb9123d7019a5b
Last active August 29, 2015 14:09
mikrotik_netwatch_add
/tool netwatch
add disabled=no down-script="Squid OFF" host=192.168.7.250 interval=1m timeout=1s up-script="Squid ON"
@yenleidong
yenleidong / gist:fadab3ab6f42b8e650fe
Last active August 29, 2015 14:09
mikrotik_add_script_squid_netwatch
/script
add name="Squid ON" policy=ftp,reboot,read,write,policy,test,winbox,password source=\
":log info \"Squid ON, Enabling NAT Redirect\"\r\
\n/ip firewall nat set [find comment=Redirect_Ke_Squid] disable=no"
add name="Squid OFF" policy=ftp,reboot,read,write,policy,test,winbox,password source=\
":log info \"Squid OFF, Disabling NAT Redirecti\"\r\
\n/ip firewall nat set [find comment=Redirect_Ke_Squid] disable=yes"
@yenleidong
yenleidong / gist:2476bfac9a1b60917e09
Last active August 29, 2015 14:09
tinynav.min.js
/*! http://tinynav.viljamis.com v1.1 by @viljamis */
(function(a,i,g){a.fn.tinyNav=function(j){var b=a.extend({active:"selected",header:"",label:""},j);return this.each(function(){g++;var h=a(this),d="tinynav"+g,f=".l_"+d,e=a("<select/>").attr("id",d).addClass("tinynav "+d);if(h.is("ul,ol")){""!==b.header&&e.append(a("<option/>").text(b.header));var c="";h.addClass("l_"+d).find("a").each(function(){c+='<option value="'+a(this).attr("href")+'">';var b;for(b=0;b<a(this).parents("ul, ol").length-1;b++)c+="- ";c+=a(this).text()+"</option>"});e.append(c);
b.header||e.find(":eq("+a(f+" li").index(a(f+" li."+b.active))+")").attr("selected",!0);e.change(function(){i.location.href=a(this).val()});a(f).after(e);b.label&&e.before(a("<label/>").attr("for",d).addClass("tinynav_label "+d+"_label").append(b.label))}})}})(jQuery,this,0);
chattr -i filegue
#contoh file yang Imutabilitas
chattr +i foldergue
#atau
chattr +i filegue