Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
aaaaaaaaaaaarx

Yusuf Al Majid ajid2

🔥
aaaaaaaaaaaarx
View GitHub Profile
View get_table_size.sql
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema="your_db_name"
ORDER BY (data_length + index_length) DESC
@ajid2
ajid2 / $.md
Last active Nov 30, 2021
clink alias
View $.md

Setup Clink

  • Download clink clink.zip
  • Unzip at safe place
  • Open registry editor regedit
  • Search for HKEY_CURRENT_USER\Software\Microsoft\Command Processor
  • Modify AutoRun to "C:\Program Files (x86)\clink\0.4.9\clink.bat" inject --autorun --profile ~\clink && doskey.exe /macrofile=%LOCALAPPDATA%\clink\aliases

This is content of my aliases file

View date_loop.js
Array(TOTAL_DATE).fill().forEach((_, i) => {
const date = new Date(new Date().getFullYear(), new Date().getMonth(), i + 1)
const day = date.getDate()
const month = date.toLocaleString('default', { month: 'long' })
const year = date.getFullYear()
const dateString = `${day} ${month} ${year}`
$('#date-box').append(`<div class="date-box-item">${dateString}</div>`)
})
View server.com.conf
[program:server.com]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/server.com/public_html/artisan queue:work database --sleep=5 --tries=2 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=webmanager
numprocs=8
redirect_stderr=true
@ajid2
ajid2 / .htaccess
Created Aug 31, 2021
Permanent redirect to HTTPS
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
@ajid2
ajid2 / functions.php
Created Aug 31, 2021
wordpress hide author page
View functions.php
<?php
add_action('template_redirect', 'my_custom_disable_author_page');
function my_custom_disable_author_page() {
global $wp_query;
if ( is_author() ) {
$wp_query->set_404();
status_header(404);
}
}
@ajid2
ajid2 / ssh_remote.md
Last active Jul 31, 2021
SSH Dari Lokal Ke Remote
View ssh_remote.md

Remote SSH

scenario : kamu ingin memperlihaktan hasil kerjamu ke client dari jarak jauh, tetapi masih tahap development. Solusi termudah adalah menggunakan ngrok, tetapi ngrok itu dinamis kalo mau statis harus bayar. Solusi lainnya adalah ini:

Di Server

  • Aktifkan konfigurasi GatewayPort yes di sshd_config
  • Restart sshd sudo systemctl restart sshd

Di Lokal

@ajid2
ajid2 / index.html
Created Jul 24, 2021
Congratulation - HBD - etc
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Confetti Particle</title>
<style>
canvas{
position: fixed;
@ajid2
ajid2 / select.html
Created Jul 5, 2021
select2.js awesome
View select.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
<link
href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css"
rel="stylesheet"
@ajid2
ajid2 / command.sh
Last active Jun 29, 2021
Command yang sering gw pake sehari hari
View command.sh
find -type f -name "*.php" -not -path "*/vendor/*" -exec grep "exec(" {} \;
find -name "*.php" \( -path wp-admin -o -path wp-includes -o -name vendor \) -prune -exec grep -i --color=always 'eval(' {} \; -print
find -type f -perm 777
find -type f -executable
find -type d -name "*wp-file-manager*" | xargs rm -r