Skip to content

Instantly share code, notes, and snippets.

View ebta's full-sized avatar

Ebta Setiawan ebta

View GitHub Profile
@ebta
ebta / backup-web.sh
Created December 9, 2020 15:45
Backup semua directory /var/www/html
#! /bin/bash
NOW=$(date +"%F_%H%M%S")
BACKUP_DIR="/path/to/backup"
BACKUP_LOG="$BACKUP_DIR/backup-web.log"
WWW_DIR="/var/www/html"
webdirs="dir1 dir2 dir3 dir4 dir5"
function log() {
@ebta
ebta / grayscale.md
Last active November 22, 2020 14:45 — forked from anderflash/grayscale.sh
Convert PDF to Grayscale using ghostscript

Install ghostscript from yout terminal : sudo apt install ghostscript, then create file, for example pdf2gray.sh and copy paste the script bellow. Add execution access using chmod +x pdf2gray.sh

#!/bin/bash

gs \
 -sOutputFile=$2 \
 -sDEVICE=pdfwrite \
 -sColorConversionStrategy=Gray \
 -dProcessColorModel=/DeviceGray \
 -dCompatibilityLevel=1.4 \
@ebta
ebta / vue-obj-value.md
Last active November 6, 2020 02:28
Mengambil value object dari v-model Vue

Ketika ingin mengambil value object dari v-model Vue, kita tidak bisa langsung mengambil variabel/v-model, karena disana ada setter, getter dan property reactive vue lainnya. Berikut beberapa cara yg bisa dipakai, misal nama model disini adalah vueObj atau vm.$data untuk semua object Vue instance

Rekomendasi Evan Yue

JSON.parse(JSON.stringify(vueObj)).

Ada pendapat lain, "It is said that JSON.parse(JSON.stringify()) is a good method in this discussion, but I think that using JSON.stringify is not a good method.

@ebta
ebta / httpd.md
Last active November 6, 2020 02:31
Error load extension library di Apache 2.4

Error semisal: PHP Startup: Unable to load dynamic library

Pastikan Download Apache sudah sesuai versi PHP ( VC15, Win32/64, Apache pilih ThreadSafe/TS )

Contoh kombinasi PHP dan Apache, misalnya :

  • php-7.4.10-Win32-vc15-x64 + httpd-2.4.46-win64-VS16/httpd-2.4.46-win64-VS15
  • php-7.4.12-Win32-vc15-x86 + httpd-2.4.46-win32-VC16/httpd-2.4.46-win32-VC15
@ebta
ebta / php redis.md
Last active September 29, 2020 13:41
Install PHP Redis on Ubuntu Server

PHPRedis

PHPRedis adalah library php untuk mengakses Redis (key-value memory storage/database), dari sini phpredis

Requirements (Install Redis)

Install Redis melalui source (lebih update), melalui tutorial di DigitalOcean Install Redis from Source, ringkasan installnya sebbagai berikut :

sudo apt update
sudo apt install build-essential tcl
curl -O http://download.redis.io/redis-stable.tar.gz
@ebta
ebta / remove mysql password plugin.md
Created September 25, 2020 09:02
remove mysql password plugin

Here is what I do to remove the validate password plugin:

Login to the mysql server as root mysql -h localhost -u root -p Run the following sql command:

uninstall plugin validate_password;

If last line doesn't work (new mysql release), you should execute

@ebta
ebta / install db driver php.md
Last active January 29, 2023 16:59
Install database driver extension (PosgreSQL, MS SQL, Oracle) di PHP - Ubuntu Server

Proses-proses berikut awalnya (utamanya) dijalankan di Ubuntu 20.04 dengan PHP 7.4, tetapi harusnya bisa diterapkan di versi selainnya.

Install Driver PosgreSQL

  1. Install driver PDO PgSQL, Default akan menginstall sesuai versi php, misalnya berikut ini akan install php7.4-pgsql. Setelah install, biasanya langsung aktif tanpa perlu restart php
sudo apt install php-pgsql

Install Driver SQL Server

@ebta
ebta / php.ini
Last active November 6, 2020 02:36
Setting php.ini PHP 7.4 + Apache 2.4 VC16 (Windows) development (lihat revisions)
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@ebta
ebta / httpd.conf
Last active November 6, 2020 02:37
Apache 2.4 VC 16 Conf and PHP 7.4 Windows (lihat revisions)
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@ebta
ebta / gist:37aab281e37c71810b6ef2f34cbe4cdf
Created August 13, 2020 07:49 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>