var elems = Array.prototype.slice.call(document.querySelectorAll(‘.js-switch’)); Explanation: document.querySelectorAll(‘ClassName ID’) – Get All Class or id element and put into object Array.prototype.slice.call – Convert Object into Array Looping:- elems.forEach(function(html) { ### Your Code Here ### });
Gnome Terminal – ssh execute with command
gnome-terminal –command ‘ssh -t -p22122 julius@jumper.aims.tameko.co “tmux a”‘
Shell Scripting Accepting Argv , getops , checking , echoing
#!/bin/bash #getopts checking for argv and define it into variables #options that needs to receive parameter have to enter : after the option EG: f:u:d: #In This Example h does not accept parameter. it execute the case only while getopts u:d:p:f:h option do case “${option}” in u) USER=${OPTARG};; d) DATE=${OPTARG};; p) PRODUCT=${OPTARG};; f) FORMAT=$OPTARG;; h) […]
MysqlDump without locking Tables
# dumping data without lock table mysqldump -u[USER] -p[PASS] –skip-lock-tables –single-transaction –flush-logs –hex-blob –master-data=2 –max_allowed_packet=1G globe_sdp > globe_sdp_v2.sql
Javascript redirection with post value (PHP)
fn_do_submit_post($url,$arr_post); function fn_do_submit_post($posting_url, $arr_post){ echo “<form action=’$posting_url’ method=’post’ name=’frm’>”; foreach ($arr_post as $a => $b){ echo “<input type=’hidden’ name='”.htmlentities($a).”‘ value='”.htmlentities($b).”‘>”; } echo “</form>”; echo “<script type=’text/javascript’>”; echo “document.frm.submit();”; echo “</script>”; }
Linux Looping Command Line
while (true); do date; ps -eaf | grep httpd | wc -l; sleep 1; echo -e “\e[3A\r”; done; So let me explain the code above So basically its looping a bunch of code , and this script is to grep total count of httpd worker and printing it over and over every second. So what […]
Array Difference Between Large Arrays (PHP)
Hi, today i’ve encounter a two large array to be compare. Array 1 is around 50k data and Array 2 is around 500k data. So what i wanna eliminate is , If Array2’s data exist in Array1 , i want it out from Array 2. So here’s what i will normally do (SLOW VERSION 🙁 […]
Git add recursively for specific extension only
find . -name ‘*.java’ -print0 | xargs -0 git add
How to Prevent Web Attack: Jorgee Vulnerability Scanner
Recently i’ve added a few method of blocking some ip and user agent for my server. For my server , i am using nginx as my web server. What is Jorgee Vulnerability Scanner?Here are some example of Jorgee Vulnerability Scanner. 46.142.55.116 – – [11/Sep/2017:22:02:10 +0000] “HEAD http://198.167.140.231:80/mysql/admin/ HTTP/1.1” 404 0 “-” “Mozilla/5.0 Jorgee” 46.142.55.116 – […]
FullCalender.io (Nice & Convinient Plugin for Calender Events Handling )
https://fullcalendar.io/