Skip to content

Instantly share code, notes, and snippets.

View binsarjr's full-sized avatar
👋
KNTL (Keep Never Tired Learning)

Binsar Dwi Jasuma binsarjr

👋
KNTL (Keep Never Tired Learning)
View GitHub Profile
const headlessDetected = () => {
alert("Automation detected")
}
// Test for user agent
function testUserAgent() {
const userAgent = ['phantomjs', 'Headless']
let agent = navigator.userAgent;

Auto target blank when difference host

document.addEventListener("click", function (e) {
  if (!e?.target?.href) return
  if (new URL(e.target.href).host != new URL(window.location.href).host && !e.target.hasAttribute("target")) {
    e.preventDefault();
    e.target.setAttribute("target", "_blank");
    window.open(e.target.href,'_blank')
  }
});

Dont use system("PAUSE") again

use this

system("read -p 'Press Enter to continue...' var");

.htaccess to hide directory laravel projects. Take care when you forget

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
 RewriteRule !public [F,R=404]

I've required the same thing and i wrote a short library that works for CryptoJS 3.x and PHP with openssl support. Hope this helps, source plus example files here https://github.com/brainfoolong/cryptojs-aes-php

PHP Lib

/**
* Decrypt data from a CryptoJS json encoding string
*
* @param mixed $passphrase
* @param mixed $jsonString
* @return mixed

Currently, the best filesystem to share content between Windows and Linux is exFAT, specially on USB pendrives and SD cards. exFAT is, roughly speaking, a revision of FAT32 without the 4GB max file size limitation.

If not installed, you will have to install exFAT support.

$ sudo apt install exfat-utils

From here, you have two options. Use a graphical tool like gparted or the command line (which is more fun). Find below steps for the latter.

#!/usr/bin/bash
# function untuk mengubah versi php-cli
# taruh di .bashrc supaya sudah autoload
function switch_php() {
PHPFILE=/usr/bin/php$1
if test -f "$PHPFILE"; then
sudo update-alternatives --set php $PHPFILE
fi
<?php
function caesar_cipher_encode(string $text, int $key = 1)
{
for ($i=0;$i<strlen($text);$i++) {
$code[$i] = ord($text[$i]); //rubah ASCII ke desimal
$b[$i] = ($code[$i] + $key) % 256; //proses enkripsi
$c[$i] = chr($b[$i]); //rubah desimal ke ASCII
}
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=84600, public"
</filesMatch>