Posts

Showing posts with the label Script

Full page blogger css

Image
How to show only content on blogger page <style> @media only screen and (min-width: 1025px) { #sidebar-wrapper, #midsidebar-wrapper, .gapad2, .blog-pager, .post-header-line-1, .post-footer { display: none !important; } #main-wrapper { width: 150% !important; /*98% default*/ } .post { width: 150% !important; /*98% default*/ } #comments { width: 150% !important; /*98% default*/ } .post-title, .post-labels, post-icons, post-author { display: none !important; } } </style> OR <style scoped="" type="text/css"> #outer-wrapper { margin: 0 auto; text-align: left; float: none; background-position: center !important; } #post-wrapper { width: 100%; max-width: 100%; margin: 0 auto; text-align: left; float: none; background-position: center !important; } .post-body, .post { background-position: cente

Fix Uncaught Error Call to undefined function str_starts_with()

Image
Uncaught Error: Call to undefined function str_starts_with() Fix Solutions if (!function_exists('str_starts_with')) { function str_starts_with($haystack, $needle, $case = true) { if ($case) { return strpos($haystack, $needle, 0) === 0; } return stripos($haystack, $needle, 0) === 0; } } if (!function_exists('str_ends_with')) { function str_ends_with($haystack, $needle, $case = true) { $expectedPosition = strlen($haystack) - strlen($needle); if ($case) { return strrpos($haystack, $needle, 0) === $expectedPosition; } return strripos($haystack, $needle, 0) === $expectedPosition; } }

Import composite build plugin as subtitue module dependency [Gradle]

Image
// change folder path inside bracket includeBuild("plugin") { dependencySubstitution { // change your artifact group and id // iam using https://github.com/dimaslanjaka/gradle-plugin/ for example substitute(module("com.dimaslanjaka:gradle-plugin")).with(project(":")) } }

[PHP] Detect User Client IP (XAMPP or Localhost Machine Supported)

Usage: var_dump(get_client_ip()); /** * Detect is localhost * * @return boolean */ function isLocalHost() { $whitelist = [ '127.0.0.1', '::1', ]; return in_array($_SERVER['REMOTE_ADDR'], $whitelist); } /** * Get client ip, when getenv supported (maybe cli) * * @return string */ function get_client_ip() { $ipaddress = ''; if (isLocalHost()) { $ipaddress = getLocalIp(); } else { if (getenv('HTTP_CLIENT_IP')) { $ipaddress = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_X_FORWARDED')) { $ipaddress = getenv('HTTP_X_FORWARDED'); } elseif (getenv('HTTP_FORWARDED_FOR')) { $ipaddress = getenv('HTTP_FORWARDED_FOR'); } elseif (getenv('HTTP_FORWARDED')) { $ipaddress = getenv('HTTP_FORWARDED'); } elseif (ge

Calculate Swatch Internet Time Codes

PHP 12 bytes: <?php echo date('B'); ?> 48 bytes: <?php echo sprintf("%03d",((time()+3600)%86400)/86.4|0); ?> C,  56 bytes main(){printf("%03d",(int)((time(0)+3600)%86400/86.4));} Explanation: %03d  - tells printf to zero-pad up to 3 digits. time(NULL)+3600  - gets amount of seconds (UTC) elapsed since epoch and adds an hour to it (UTC+1). %86400  - divides epoch by the amount of seconds in a 24hr day and gets the remainder (representing seconds elapsed, so far, "today"). /86.4  - divide remaining seconds by 86.4 to get the ".beat" count since midnight (UTC+1). Compile (MSVC): C:> cl swatch.c Compile (GCC): $ gcc swatch.c Java 143 bytes import  java.time. * ; interface A  {   static void main(String[] a) {     System.out.format("%03.0f" ,  LocalTime.now(ZoneId.of("UT+1")).toSecondOfDay() / 86.4);    } } Javascript d=new Date();t=;console.log(Math.floor((360*d.getHours()+60*d.

Linux Clear Cache

#!/bin/bash #clean page cache #sync #echo 1 >/proc/sys/vm/drop_caches #clean dentries and inodes #sync #echo 2 >/proc/sys/vm/drop_caches #clean page cache and dentries inodes, but it is not recommended in production instead use "echo 1" #sync #echo 3 >/proc/sys/vm/drop_caches ################## # begin refresh script ################## sync if [ $(dpkg-query -W -f='${Status}' polipo 2>/dev/null | grep -c "ok installed") -eq 0 ]; then apt-get install polipo -y fi polipo -x echo 3 >/proc/sys/vm/drop_caches swapoff -a && swapon -a printf '\n%s\n\n' 'Ram-cache and Swap Cleared' /opt/lampp/xampp restart free -h this script used for better performance your vps (LINUX). fix apache slow response fix xampp web server slow fix overload ram vps fix mysqld overheat fix java machine overheat ram

[JS][PHP] Regexp for matching URL Pattern

Image
Regexp Pattern Untuk mencocokkan semua jenis URL, kode berikut seharusnya berfungsi: <?php $regex = "((https?|ftp)://)?"; // SCHEME $regex .= "([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?"; // User and Pass $regex .= "([a-z0-9\-\.]*)\.(([a-z]{2,4})|([0-9]{1,3}\.([0-9]{1,3})\.([0-9]{1,3})))"; // Host or IP $regex .= "(:[0-9]{2,5})?"; // Port $regex .= "(/([a-z0-9+$_%-]\.?)+)*/?"; // Path $regex .= "(\?[a-z+&\$_.-][a-z0-9;:@&%=+/$_.-]*)?"; // GET Query $regex .= "(#[a-z_.-][a-z0-9+$%_.-]*)?"; // Anchor ?> Example: correctly way for matching URL <?php if(preg_match("~^$regex$~i", 'www.example.com/etcetc', $m)) var_dump($m); if(preg_match("~^$regex$~i", 'http://www.example.com/etcetc', $m)) var_dump($m); ?> Pattern diatas bisa digunakan di javascript. Bedanya dengan diatas hanya dari segi vari

Cara install heroku CLI di Termux

Image
Heroku adalah platform cloud sebagai layanan (PaaS) yang mendukung beberapa bahasa pemrograman. Heroku, salah satu platform cloud pertama, telah dikembangkan sejak Juni 2007, ketika hanya mendukung bahasa pemrograman Ruby, tetapi sekarang mendukung Java, Node.js, Scala, Clojure, Python, PHP, dan Go. Untuk alasan ini, Heroku dikatakan sebagai platform polyglot karena memungkinkan pengembang membangun, menjalankan, dan menskala aplikasi dengan cara yang sama di semua bahasa. Heroku diakuisisi oleh Salesforce.com pada 2010 sebesar $ 212 juta. Berikut tutorial untuk install Heroku App dan pre-requirements nya: Instalasi PHP di Termux Instalasi Composer di Termux Instalasi Node.js di Termux Instalasi Heroku App CLI di Termux Tahap 1: update & upgrade apt cd $HOME apt update -y apt upgrade -y Tahap 2: install PHP dan Composer cd $HOME apt install php -y php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file

[NEW] Script Terbaru auto Reaction Facebook dan auto refresh token

Image
Release lagi nih : [PHP] Script Auto Reaction Timeline Facebook dengan kemampuan : Auto refresh token Support multiple accounts Flexible (Native/Command line) Options untuk like komen (true/false) Settingan per akun Nah tidak lama-lama langsung saja visit Download Script Auto Reaction Timeline Facebook

Get CPU usage / RAM usage [PHP]

if you mean how much ram/cpu php is using then you can do the following using plain php without using any package: this returns the ram usage: function get_server_memory_usage(){ $free = shell_exec('free'); $free = (string)trim($free); $free_arr = explode("\n", $free); $mem = explode(" ", $free_arr[1]); $mem = array_filter($mem); $mem = array_merge($mem); $memory_usage = $mem[2]/$mem[1]*100; return $memory_usage; } cpu usage: function get_server_cpu_usage(){ $load = sys_getloadavg(); return $load[0]; } Native Conditions: $load = sys_getloadavg(); $limit =15; //percent cpu if ($load[0] >= $limit) { die("Oops Server Busy, this message was automate from Dimas Lanjaka For telling users, there too many processed."); }

[NEW] Script auto reaction facebook dan auto refresh token PHP

Image
Download Script auto reaction facebook Step by Step Install BOT reaction for cPanel Download Scriptnya . simpan dengan nama bot.php Kalau sudah, Save File Bot nya lalu Upload ke Hosting kalian masing-masing.. Sekarang waktunya Setting Cronjob buat File Bot kalian, agar bisa berjalan dalam waktu yg udah ditentukan :) Untuk settingannya kalian bisa lihat seperti gambar dibawah ini : nb. Untuk Waktu Eksekusi, itu terserah sesuai kalian masing2.. :) Kalo udah mantep settingannya, Klik Add New Cron Job. dan Lihatlah Akun facebook agan bakal ngelike status temen secara otomatis sesuai waktu yang sudah ditentukan tadi. Atau bila kalian bingung dengan tutorial pemasangan cronjob diatas. anda bisa menggunakan alternatif Di Pencarian ini atau Cara Membuat Cron Job Menggunakan webcron.org Cara Install Bot Auto Reaction Facebook Lewat Termux Download Scriptnya . simpan dengan nama bot.php Taruh fil

Pure Javascript Geolocation

Image
Read How to async defer CSS JS perfectly <script> function locationSuccess(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; var altitude = position.coords.altitude; var accuracy = position.coords.accuracy; var altitudeAccuracy = position.coords.altitudeAccuracy; var heading = position.coords.height; var speed = position.coords.speed; var timestamp = position.timestamp; // bekerja dengan informasi ini sesuka Anda! } function locationError(error) { var code = error.code; var message = error.message; // baca kode dan pesan dan putuskan bagaimana Anda ingin menangani ini! } navigator.geolocation.getCurrentPosition(locationSuccess, locationError); </script>

Install deb package via Termux

Image
Packages are manually installed via the dpkg command (Debian Package Management System). dpkg is the backend to commands like apt-get and aptitude , which in turn are the backend for GUI install apps like the Software Center and Synaptic. Something along the lines of: dpkg --> apt-get , aptitude --> Synaptic, Software Center But of course the easiest ways to install a package would be, first, the GUI apps (Synaptic, Software Center, etc..), followed by the terminal commands apt-get and aptitude that add a very nice user friendly approach to the backend dpkg, including but not limited to packaged dependencies, control over what is installed, needs update, not installed, broken packages, etc.. Lastly the dpkg command which is the base for all of them. Since dpkg is the base, you can use it to install packaged directly from the command line. Install a package sudo dpkg -i DEB_PACKAGE For

FTP Backup File Recursively PHP Script

Image
FTP FILE BACKUP RECURSIVELY Auto Zipping All files Inside Directory Auto Send Zipped files to FTP at once Auto Cleaning sent Zipped files on local storage <?php define("user", "username_ftp", true); //Your FTP Username define("password", "password_ftp", true); //Your FTP Password define("host", "host_ftp", true); //eg: ftp.drivehq.com define("port", "21", true); //default ftp port is 21 /*** Script_By_Dimas_Lanjaka ***/ if (defined("user") && defined("password") && defined("host")){ // Get real path for our folder// Get real path fo $rootPath = realpath(__DIR__); //array_map('unlink', glob("$rootPath*.zip")); // Initialize archive object $zip = new ZipArchive(); $cdate = str_replace('.', '-', $_SERVER['HTTP_HOST']); $zip->open($cdate . '.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); //

00webhost unzipper script php

Image
Features: Detect zip file automatically Extract zip to custom folder Detect zip file on subfolder Unzipper tools php script <?php /** * The Unzipper extracts .zip or .rar archives and .gz files on webservers. * It's handy if you do not have shell access. E.g. if you want to upload a lot * of files (php framework or image collection) as an archive to save time. * As of version 0.1.0 it also supports creating archives. * * @author Andreas Tasch, at[tec], attec.at * @license GNU GPL v3 * @package attec.toolbox * @version 0.1.1 */ define('VERSION', '0.1.1'); $timestart = microtime(TRUE); $GLOBALS['status'] = array(); $unzipper = new Unzipper; if (isset($_POST['dounzip'])) { // Check if an archive was selected for unzipping. $archive = isset($_POST['zipfile']) ? strip_tags($_POST['zipfile']) : ''; $destination = isset($_POST['extpath']) ? strip_tags($_POST['extpath']) : ''; $

00webhost file manager alternative

Image
Feature: Support unzip file Support edit file/script on different encodings Support upload,edit,open,delete,rename,and other. Support add username and password. And any other. H3K | Tiny File Manager Modified By Dimas Lanjaka <?php /** * H3K | Tiny File Manager * CCP Programmers * http://fb.com/ccpprogrammers * https://github.com/prasathmani/tinyfilemanager */ // Default language $lang = 'en'; // Auth with login/password (set true/false to enable/disable it) $use_auth = true; // Users: array('user' => 'user', 'user' => 'user2', etc); $auth_users = array( 'your_username' => md5('your_password'), 'user2' => md5('pass2'), ); // Readonly users (usernames array) $readonly_users = array( 'user2' ); // Show or hide files and folders that starts with a dot $show_hidden_files = true; // Enable highlight.js (https://highlightjs.org/) on view's page $use_h