Skip to content

Instantly share code, notes, and snippets.

View arisnew's full-sized avatar

Aris Priyanto arisnew

View GitHub Profile
@arisnew
arisnew / docker-compose-mysql-phpmyadmin.md
Created April 23, 2024 12:06
contoh docker compose mysql + phpmyadmin
version: '3.1'
services:
  db:
    image: mysql:latest
    container_name: db
    # restart: unless-stopped
    environment:
      MYSQL_ROOT_USERNAME: root
 MYSQL_ROOT_PASSWORD: root
@arisnew
arisnew / connect-vpn-docker-mac.md
Created November 30, 2023 04:46
Could not connect to external network VPN from Docker Mac

Jika dari docker tidak bisa konek ke jaringan luar via VPN bisa mencoba hal berikut:

  • drop dulu container yang jalan docker compose down
  • reset all network docker (Peringatan : ini akan menghapus semua network yg ada di docker) docker network prune
  • kemudian jalankan lagi container docker compose up -d

Ref https://stackoverflow.com/a/65598942

@arisnew
arisnew / update-noupdate-1-odoo-xml.md
Created November 26, 2023 08:38
Cara Update record xml yang sebelumnya noupdate="1" di Odoo

Secara default kita tidak bisa mengubah dengan inherit view atau data xml odoo yang noupdate="1", agar bisa diupdate perlu set dahulu menggunakan function.

Contoh (view xml):

    <!-- Allow updating on noupdate=True records -->
    <function name="write" model="ir.model.data">
        <function name="search" model="ir.model.data">
            <value
                eval="[('module', '=', 'base'), ('name', '=', 'partner_root')]" />
@arisnew
arisnew / python-format-number-manual.md
Created November 24, 2023 03:01
Python format number manual

python : manual convert output number like 1.234.567,89

num = 1234567.89

value_split = '{:.2f}'.format(float(num))
decimal_split = str(value_split).split('.')
add_separators = '{:,}'.format(int(decimal_split[0]))
result = add_separators.replace(',', '.')
if len(decimal_split) &gt; 1:
@arisnew
arisnew / example-DATE_ADD-mysql.md
Created November 9, 2023 05:08
Penggunaan `DATE_ADD` pada query MySQL

NOTE

  • Jangan gunakan DATE_ADD pada column di statement WHERE karena berpengaruh ke performa, bisa dibalik dibandingkan dengan waktu saat ini.
  • contoh :
SELECT 
    hd.*
FROM das_history_detail hd
JOIN das_history h ON hd.history_id = h.id
LEFT JOIN workflow_node wn ON hd.node_id = wn.id
@arisnew
arisnew / chart-in-odoo-pdf-report.md
Created October 13, 2023 06:19
Chart in Odoo PDF Report
@arisnew
arisnew / sudo-cd.md
Created September 1, 2023 07:07
Cara alternatif cd dan eksekusi command lain via sudo
sudo sh -c "cd restricted-dir; some_command"
@arisnew
arisnew / mysql_change_collation.md
Created August 28, 2023 05:10
Mengatasi `Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation`

Misal ada error saat eksekusi storage procedure MySQL seperti berikut: Error Code: 1267. Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

Solusi bisa dengan ubah charset & collate column yang dimaksud, caranya

ALTER TABLE `nama_table` MODIFY `nama_column` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
@arisnew
arisnew / ONLY_FULL_GROUP_BY_mysql_mac.md
Created July 5, 2023 06:17
Disable ONLY_FULL_GROUP_BY mysql Mac
  • jika belum ada file config, kita bisa buat file baru, misal my.cnf di /usr/local/mysql-8.0.33-macos13-arm64
  • edit dan tambahkan config berikut:
[mysqld]
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
  • set file setting tersebut di mysql setting mac
  • restart mysql