<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Teddy Zugana</title>
    <description>The latest articles on Forem by Teddy Zugana (@kevinmel2000).</description>
    <link>https://forem.com/kevinmel2000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F245271%2Fb2c65bdc-18d8-4a45-97dc-0207c4ddd173.jpg</url>
      <title>Forem: Teddy Zugana</title>
      <link>https://forem.com/kevinmel2000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kevinmel2000"/>
    <language>en</language>
    <item>
      <title>Cara Menginstall Wazuh di Ubuntu Server</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Fri, 14 Nov 2025 01:58:54 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/cara-menginstall-wazuh-di-ubuntu-server-3f8k</link>
      <guid>https://forem.com/kevinmel2000/cara-menginstall-wazuh-di-ubuntu-server-3f8k</guid>
      <description>&lt;p&gt;Pada kesempatan kali ini kita akan menginstall wazuh di ubuntu versi 24.04. Sebelum mulai proses instalasi, ada beberapa hal yang perlu disiapkan.&lt;/p&gt;

&lt;p&gt;Requirement&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;VPS : 2 vCPU, 4 GB RAM, 50 GB Disk
OS : Ubuntu 16.04, 18.04, 20.04, 22.04, 24.04
Port : 443,1514,1515,55000,9200,9300–9400 (TCP)
Infrastruktur : AWS, GCP, Digital Ocean, VPS Lokal, Bare Metal/On-Premise. VirtualBox, VMWare

Baca Juga : Cara Mengamankan Server Ubuntu dari Peretas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Metode Instalasi&lt;/p&gt;

&lt;p&gt;Ada beberapa metode instalasi yang ada untuk menginstall wazuh di ubuntu. Tapi untuk tutorial kali ini kita akan menggunakan metode instalasi Wazuh installation assistant.&lt;br&gt;
Langkah #1 : Update Package Server&lt;/p&gt;

&lt;p&gt;Langkah wajib yang harus dilakukan sebelum mulai proses instalasi adalah update dan upgrade package di server terlebih dahulu.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mengubah Timezone&lt;/p&gt;

&lt;p&gt;Atur timezone sesuai dengan lokasi Anda agar waktu di server lebih mudah dibaca, terutama saat membaca log atau mengatur penjadwalan otomatis seperti cronjob. Contohnya, pilih Asia/Jakarta untuk Waktu Indonesia Barat.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sudo dpkg-reconfigure tzdata
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Langkah #2 : Jalankan Wazuh Installation Assistant&lt;/p&gt;

&lt;p&gt;Jalankan perintah di bawah ini di server yang akan dijadikan wazuh server. Akan tampil proses instalasi Wazuh. Tunggu proses instalasinya sampai selesai.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sO https://packages.wazuh.com/4.9/wazuh-install.sh &amp;amp;&amp;amp; sudo bash ./wazuh-install.sh -i -a 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;4.9 adalah versi dari wazuh yang akan diinstall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Wazuh Installation Assistant&lt;/p&gt;

&lt;p&gt;Setelah proses instalasi selesai, akan muncul user dan password untuk mengakses dashboard wazuh. Simpan baik-baik user dan password tersebut.&lt;/p&gt;

&lt;p&gt;Note:&lt;br&gt;
Untuk melihat semua password wazuh indexer dan wazuh API, atau lupa password wazuh dashboard, Anda bisa menggunakan perintah berikut :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sudo tar -O -xvf wazuh-install-files.tar wazuh-install-files/wazuh-passwords.txt

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Langkah #3 : Mengakses Dashboard Wazuh&lt;/p&gt;

&lt;p&gt;Untuk mengakses dashboard wazuh, masukkan ip address server wazuh ke search bar browser seperti chrome, atau firefox. Silahkan login menggunakan user dan password yang tadi sudah digeneratekan oleh wazuh installation assistant.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;ip-dashboard-wazuh&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Login Wazuh Dashboard&lt;/p&gt;

&lt;p&gt;Dan seperti inilah tampilan web dashboard wazuh setelah berhasil login.&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>wazuh</category>
    </item>
    <item>
      <title>Cara Mengatur Blok Server Nginx (Host Virtual) di Ubuntu</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Fri, 23 May 2025 09:12:34 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/cara-mengatur-blok-server-nginx-host-virtual-di-ubuntu-402a</link>
      <guid>https://forem.com/kevinmel2000/cara-mengatur-blok-server-nginx-host-virtual-di-ubuntu-402a</guid>
      <description>&lt;p&gt;aat menggunakan server web Nginx, blok server (mirip dengan host virtual di Apache) dapat digunakan untuk merangkum detail konfigurasi dan menghosting lebih dari satu domain pada satu server.&lt;/p&gt;

&lt;p&gt;Dalam panduan ini, kita akan membahas cara mengonfigurasi blok server di Nginx pada server Ubuntu 16.04.&lt;/p&gt;

&lt;p&gt;Terapkan aplikasi Anda dari GitHub menggunakan DigitalOcean App Platform . Biarkan DigitalOcean fokus pada penskalaan aplikasi Anda.&lt;br&gt;
Prasyarat&lt;/p&gt;

&lt;p&gt;Kami akan menggunakan pengguna non-root dengan sudohak istimewa di sepanjang tutorial ini. Jika Anda belum mengonfigurasi pengguna seperti ini, Anda dapat membuatnya dengan mengikuti panduan pengaturan server awal Ubuntu 16.04 kami .&lt;/p&gt;

&lt;p&gt;Anda juga perlu memasang Nginx di server Anda. Panduan berikut membahas prosedur ini:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cara Memasang Nginx di Ubuntu 16.04 : Gunakan panduan ini untuk menyiapkan Nginx sendiri.
Cara Menginstal Linux, Nginx, MySQL, PHP (tumpukan LEMP) di Ubuntu 16.04 : Gunakan panduan ini jika Anda akan menggunakan Nginx bersama dengan MySQL dan PHP.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Jika Anda telah memenuhi persyaratan ini, Anda dapat melanjutkan dengan panduan ini.&lt;br&gt;
Contoh Konfigurasi&lt;/p&gt;

&lt;p&gt;Untuk keperluan demonstrasi, kita akan menyiapkan dua domain dengan server Nginx kita. Nama domain yang akan kita gunakan dalam panduan ini adalah example.com dan test.com .&lt;/p&gt;

&lt;p&gt;Catatan: untuk informasi lebih lanjut tentang menyiapkan domain dengan DigitalOcean, silakan lihat dokumentasi produk Domain dan DNS kami .&lt;/p&gt;

&lt;p&gt;Jika Anda tidak memiliki dua nama domain cadangan untuk digunakan, gunakan nama pengganti untuk saat ini dan kami akan menunjukkan kepada Anda nanti cara mengonfigurasi komputer lokal untuk menguji konfigurasi Anda.&lt;br&gt;
Langkah 1 — Menyiapkan Direktori Root Dokumen Baru&lt;/p&gt;

&lt;p&gt;Secara default, Nginx pada Ubuntu 16.04 memiliki satu blok server yang diaktifkan. Blok ini dikonfigurasi untuk menyajikan dokumen dari direktori di /var/www/html.&lt;/p&gt;

&lt;p&gt;Meskipun ini berfungsi dengan baik untuk satu situs, kita memerlukan direktori tambahan jika kita akan melayani beberapa situs. Kita dapat menganggap /var/www/htmldirektori tersebut sebagai direktori default yang akan dilayani jika permintaan klien tidak cocok dengan situs kita yang lain.&lt;/p&gt;

&lt;p&gt;Kami akan membuat struktur direktori /var/wwwuntuk setiap situs kami. Konten web yang sebenarnya akan ditempatkan dalam htmldirektori di dalam direktori khusus situs ini. Ini memberi kami fleksibilitas tambahan untuk membuat direktori lain yang terkait dengan situs kami sebagai saudara dari htmldirektori tersebut jika perlu.&lt;/p&gt;

&lt;p&gt;Kita perlu membuat direktori ini untuk setiap situs kita. -pBendera tersebut memberitahu mkdiruntuk membuat direktori induk yang diperlukan di sepanjang jalan:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir -p /var/www/example.com/html
sudo mkdir -p /var/www/test.com/html
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Sekarang setelah kita memiliki direktori, kita akan menetapkan kembali kepemilikan direktori web ke akun pengguna normal kita. Ini akan memungkinkan kita menulis ke direktori tersebut tanpa sudo.&lt;/p&gt;

&lt;p&gt;Catatan: Bergantung pada kebutuhan Anda, Anda mungkin perlu menyesuaikan izin atau kepemilikan folder lagi untuk mengizinkan akses tertentu bagi www-datapengguna. Misalnya, situs dinamis sering kali memerlukan ini. Persyaratan izin dan kepemilikan khusus sepenuhnya bergantung pada konfigurasi Anda. Ikuti rekomendasi untuk teknologi tertentu yang Anda gunakan.&lt;/p&gt;

&lt;p&gt;Kita dapat menggunakan $USERvariabel lingkungan untuk menetapkan kepemilikan pada akun yang saat ini kita gunakan untuk masuk (pastikan Anda tidak masuk sebagai root ). Ini akan memudahkan kita untuk membuat atau mengedit konten dalam direktori ini:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R $USER:$USER /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/test.com/html
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Izin root web kita seharusnya sudah benar jika Anda belum mengubah umasknilainya, tetapi kita dapat memastikannya dengan mengetik:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chmod -R 755 /var/www
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Struktur direktori kita sekarang telah dikonfigurasikan dan kita dapat melanjutkan.&lt;br&gt;
Langkah 2 — Membuat Halaman Contoh untuk Setiap Situs&lt;/p&gt;

&lt;p&gt;Sekarang setelah kita menyiapkan struktur direktori, mari buat halaman default untuk setiap situs kita sehingga kita akan memiliki sesuatu untuk ditampilkan.&lt;/p&gt;

&lt;p&gt;Buat index.htmlfile di domain pertama Anda:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano /var/www/example.com/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Di dalam berkas tersebut, kita akan membuat berkas dasar yang menunjukkan situs mana yang sedang kita akses. Tampilannya akan seperti ini:&lt;br&gt;
/var/www/contoh.com/html/index.html&lt;/p&gt;


&lt;br&gt;
        Welcome to Example.com!&lt;br&gt;
    &lt;br&gt;
    &lt;br&gt;
        &lt;h1&gt;Success! The example.com server block is working!&lt;/h1&gt;
&lt;br&gt;
    &lt;br&gt;


&lt;p&gt;Simpan dan tutup berkas saat Anda selesai. Untuk melakukannya nano, tekan CTRL+ountuk menulis berkas, lalu CTRL+xuntuk keluar.&lt;/p&gt;

&lt;p&gt;Karena berkas untuk situs kedua kita pada dasarnya akan sama, kita dapat menyalinnya ke akar dokumen kedua kita seperti ini:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /var/www/example.com/html/index.html /var/www/test.com/html/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Sekarang, kita dapat membuka file baru di editor kita:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano /var/www/test.com/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ubahlah sehingga merujuk ke domain kedua kita:&lt;br&gt;
/var/www/test.com/html/indeks.html&lt;/p&gt;


&lt;br&gt;
        Welcome to Test.com!&lt;br&gt;
    &lt;br&gt;
    &lt;br&gt;
        &lt;h1&gt;Success!  The test.com server block is working!&lt;/h1&gt;
&lt;br&gt;
    &lt;br&gt;


&lt;p&gt;Simpan dan tutup berkas ini setelah selesai. Sekarang kita memiliki beberapa halaman untuk ditampilkan kepada pengunjung kedua domain kita.&lt;br&gt;
Langkah 3 — Membuat File Blok Server untuk Setiap Domain&lt;/p&gt;

&lt;p&gt;Sekarang setelah kita memiliki konten yang ingin disajikan, kita perlu membuat blok server yang akan memberi tahu Nginx cara melakukannya.&lt;/p&gt;

&lt;p&gt;Secara default, Nginx berisi satu blok server yang disebut defaultyang dapat kita gunakan sebagai templat untuk konfigurasi kita sendiri. Kita akan mulai dengan mendesain blok server domain pertama kita, yang kemudian akan kita salin untuk domain kedua kita dan buat modifikasi yang diperlukan.&lt;br&gt;
Membuat File Blok Server Pertama&lt;/p&gt;

&lt;p&gt;Seperti disebutkan di atas, kita akan membuat file konfigurasi blok server pertama kita dengan menyalin file default:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Sekarang, buka file baru yang Anda buat di editor teks Anda dengan sudohak istimewa:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Mengabaikan baris yang diberi komentar, berkasnya akan terlihat seperti ini:&lt;br&gt;
/etc/nginx/situs-tersedia/contoh.com&lt;/p&gt;

&lt;p&gt;server {&lt;br&gt;
        listen 80 default_server;&lt;br&gt;
        listen [::]:80 default_server;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
            try_files $uri $uri/ =404;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Pertama, kita perlu melihat perintah listen. Hanya satu blok server di server yang dapat default_servermengaktifkan opsi tersebut. Ini menentukan blok mana yang harus melayani permintaan jika yang server_namediminta tidak cocok dengan salah satu blok server yang tersedia. Ini seharusnya tidak sering terjadi dalam skenario dunia nyata karena pengunjung akan mengakses situs Anda melalui nama domain Anda.&lt;/p&gt;

&lt;p&gt;Anda dapat memilih untuk menetapkan salah satu situs Anda sebagai "default" dengan menyertakan default_serveropsi tersebut dalam listenarahan, atau Anda dapat membiarkan blok server default diaktifkan, yang akan menyajikan konten direktori /var/www/htmljika host yang diminta tidak dapat ditemukan.&lt;/p&gt;

&lt;p&gt;Dalam panduan ini, kami akan membiarkan blok server default tetap digunakan untuk melayani permintaan yang tidak cocok, jadi kami akan menghapus default_serverdari blok server ini dan berikutnya. Anda dapat memilih untuk menambahkan opsi ke blok server mana pun yang menurut Anda masuk akal.&lt;br&gt;
/etc/nginx/situs-tersedia/contoh.com&lt;/p&gt;

&lt;p&gt;server {&lt;br&gt;
        listen 80;&lt;br&gt;
        listen [::]:80;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    . . .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Catatan: Anda dapat memeriksa apakah default_serveropsi tersebut hanya diaktifkan dalam satu file aktif dengan mengetik:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep -R default_server /etc/nginx/sites-enabled/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Jika kecocokan ditemukan tanpa komentar di lebih dari satu file (ditampilkan di kolom paling kiri), Nginx akan mengeluh tentang konfigurasi yang tidak valid.&lt;/p&gt;

&lt;p&gt;Hal berikutnya yang harus kita sesuaikan adalah root dokumen, yang ditentukan oleh rootperintah. Arahkan ke root dokumen situs yang Anda buat:&lt;br&gt;
/etc/nginx/situs-tersedia/contoh.com&lt;/p&gt;

&lt;p&gt;server {&lt;br&gt;
        listen 80;&lt;br&gt;
        listen [::]:80;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    root /var/www/example.com/html;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Selanjutnya, kita perlu memodifikasi server_nameagar sesuai dengan permintaan untuk domain pertama kita. Kita juga dapat menambahkan alias apa pun yang ingin kita cocokkan. Kita akan menambahkan &lt;a href="http://www.example.comalias" rel="noopener noreferrer"&gt;www.example.comalias&lt;/a&gt; untuk menunjukkannya.&lt;/p&gt;

&lt;p&gt;Setelah selesai, berkas Anda akan terlihat seperti ini:&lt;br&gt;
/etc/nginx/situs-tersedia/contoh.com&lt;/p&gt;

&lt;p&gt;server {&lt;br&gt;
        listen 80;&lt;br&gt;
        listen [::]:80;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    root /var/www/example.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

    location / {
            try_files $uri $uri/ =404;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Itu saja yang kita perlukan untuk konfigurasi dasar. Simpan dan tutup berkas untuk keluar.&lt;br&gt;
Membuat File Blok Server Kedua&lt;/p&gt;

&lt;p&gt;Sekarang setelah kita memiliki konfigurasi blok server awal, kita dapat menggunakannya sebagai dasar untuk file kedua kita. Salin untuk membuat file baru:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cp /etc/nginx/sites-available/example.com /etc/nginx/sites-available/test.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Buka file baru dengan sudohak istimewa di editor Anda:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/test.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Sekali lagi, pastikan Anda tidak menggunakan default_serveropsi untuk listenarahan dalam berkas ini jika Anda telah menggunakannya di tempat lain. Sesuaikan rootarahan agar mengarah ke akar dokumen domain kedua Anda dan sesuaikan server_nameagar sesuai dengan nama domain situs kedua Anda (pastikan untuk menyertakan alias apa pun).&lt;/p&gt;

&lt;p&gt;Setelah selesai, berkas Anda kemungkinan akan terlihat seperti ini:&lt;br&gt;
/etc/nginx/situs-tersedia/test.com&lt;/p&gt;

&lt;p&gt;server {&lt;br&gt;
        listen 80;&lt;br&gt;
        listen [::]:80;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    root /var/www/test.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name test.com www.test.com;

    location / {
            try_files $uri $uri/ =404;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Setelah selesai, simpan dan tutup berkas.&lt;br&gt;
Langkah 4 — Mengaktifkan Blok Server dan Memulai Ulang Nginx&lt;/p&gt;

&lt;p&gt;Sekarang setelah kita memiliki berkas blok server, kita perlu mengaktifkannya. Kita dapat melakukannya dengan membuat tautan simbolik dari berkas-berkas ini ke sites-enableddirektori, yang dibaca Nginx saat memulai.&lt;/p&gt;

&lt;p&gt;Kita dapat membuat tautan ini dengan mengetik:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/test.com /etc/nginx/sites-enabled/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;File-file ini sekarang ditautkan ke direktori yang diaktifkan. Sekarang kita memiliki tiga blok server yang diaktifkan, yang dikonfigurasi untuk merespons berdasarkan listenarahannya dan server_name(Anda dapat membaca lebih lanjut tentang cara Nginx memproses arahan ini di sini ):&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com:Akan menanggapi permintaan untuk example.comdanwww.example.com
test.com:Akan menanggapi permintaan untuk test.comdanwww.test.com
default: Akan menanggapi permintaan apa pun pada port 80 yang tidak cocok dengan dua blok lainnya.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Untuk menghindari kemungkinan masalah memori hash bucket yang dapat muncul akibat penambahan nama server tambahan, kami juga akan menyesuaikan satu nilai dalam /etc/nginx/nginx.confberkas kami. Buka berkas sekarang:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/nginx/nginx.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Di dalam berkas, temukan server_names_hash_bucket_sizeperintah tersebut. Hapus #simbol untuk menghapus komentar pada baris:&lt;br&gt;
/etc/nginx/nginx.conf&lt;/p&gt;

&lt;p&gt;http {&lt;br&gt;
    . . .&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server_names_hash_bucket_size 64;

. . .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Simpan dan tutup berkas jika Anda sudah selesai.&lt;/p&gt;

&lt;p&gt;Berikutnya, uji untuk memastikan tidak ada kesalahan sintaksis di salah satu file Nginx Anda:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nginx -t
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Jika tidak ada masalah yang ditemukan, mulai ulang Nginx untuk mengaktifkan perubahan Anda:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Nginx sekarang seharusnya melayani kedua nama domain Anda.&lt;br&gt;
Langkah 5 — Memodifikasi File Host Lokal Anda untuk Pengujian (Opsional)&lt;/p&gt;

&lt;p&gt;Jika Anda belum menggunakan nama domain yang Anda miliki dan malah menggunakan nilai pengganti, Anda dapat mengubah konfigurasi komputer lokal agar Anda dapat menguji konfigurasi blok server Nginx untuk sementara.&lt;/p&gt;

&lt;p&gt;Ini tidak akan memungkinkan pengunjung lain melihat situs Anda dengan benar, tetapi akan memberi Anda kemampuan untuk mengakses setiap situs secara independen dan menguji konfigurasi Anda. Ini bekerja dengan cara mencegat permintaan yang biasanya masuk ke DNS untuk menyelesaikan nama domain. Sebagai gantinya, kita dapat mengatur alamat IP yang kita inginkan agar komputer lokal kita tuju saat kita meminta nama domain.&lt;/p&gt;

&lt;p&gt;Catatan: Pastikan Anda menjalankannya di komputer lokal selama langkah-langkah ini dan bukan di server jarak jauh. Anda harus memiliki akses root, menjadi anggota grup administratif, atau dapat mengedit file sistem untuk melakukan ini.&lt;/p&gt;

&lt;p&gt;Jika Anda menggunakan komputer Mac atau Linux di rumah, Anda dapat mengedit berkas yang diperlukan dengan mengetik:&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Jika Anda menggunakan Windows, Anda dapat menemukan petunjuk untuk mengubah berkas host Anda di sini.&lt;/p&gt;

&lt;p&gt;Anda perlu mengetahui alamat IP publik server Anda dan domain yang ingin Anda rutekan ke server. Dengan asumsi bahwa alamat IP publik server saya adalah 203.0.113.5, baris yang akan saya tambahkan ke berkas saya akan terlihat seperti ini:&lt;br&gt;
/dll/host&lt;/p&gt;

&lt;p&gt;127.0.0.1   localhost&lt;br&gt;
. . .&lt;/p&gt;

&lt;p&gt;203.0.113.5 example.com &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;&lt;br&gt;
203.0.113.5 test.com &lt;a href="http://www.test.com" rel="noopener noreferrer"&gt;www.test.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ini akan mencegat semua permintaan untuk example.comdan test.comdan mengirimkannya ke server Anda, yang merupakan apa yang kita inginkan jika kita tidak benar-benar memiliki domain yang kita gunakan.&lt;/p&gt;

&lt;p&gt;Simpan dan tutup berkas jika Anda sudah selesai.&lt;br&gt;
Langkah 6 — Menguji Hasil Anda&lt;/p&gt;

&lt;p&gt;Setelah semuanya siap, Anda harus menguji apakah blok server berfungsi dengan benar. Anda dapat melakukannya dengan mengunjungi domain di peramban web Anda:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://example.com" rel="noopener noreferrer"&gt;http://example.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Anda akan melihat halaman seperti ini:&lt;/p&gt;

&lt;p&gt;Blok server pertama Nginx&lt;/p&gt;

&lt;p&gt;Jika Anda mengunjungi nama domain kedua Anda, Anda akan melihat situs yang sedikit berbeda:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://test.com" rel="noopener noreferrer"&gt;http://test.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Blok server kedua Nginx&lt;/p&gt;

&lt;p&gt;Jika kedua situs ini berfungsi, Anda telah berhasil mengonfigurasi dua blok server independen dengan Nginx.&lt;/p&gt;

&lt;p&gt;Pada titik ini, jika Anda menyesuaikan hostsberkas di komputer lokal untuk pengujian, Anda mungkin ingin menghapus baris yang Anda tambahkan.&lt;/p&gt;

&lt;p&gt;Jika Anda memerlukan akses nama domain ke server Anda untuk situs publik, Anda mungkin ingin membeli nama domain untuk setiap situs Anda.&lt;br&gt;
Kesimpulan&lt;/p&gt;

&lt;p&gt;Sekarang Anda seharusnya memiliki kemampuan untuk membuat blok server untuk setiap domain yang ingin Anda hosting dari server yang sama. Tidak ada batasan nyata pada jumlah blok server yang dapat Anda buat, selama perangkat keras Anda dapat menangani lalu lintas.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Chrome Dino game cheats</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Mon, 28 Apr 2025 07:55:23 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/chrome-dino-game-cheats-12mp</link>
      <guid>https://forem.com/kevinmel2000/chrome-dino-game-cheats-12mp</guid>
      <description>&lt;p&gt;Google Chrome and Make your Dinosaur Immortal&lt;/p&gt;

&lt;p&gt;The game can be hacked pretty easily, making your dinosaur not even flinch at the sight of a cactus.&lt;/p&gt;

&lt;p&gt;To hack the game, first go the the error message page where your dinosaur is hanging out.&lt;/p&gt;

&lt;p&gt;Go ahead and press the space bar to start the game. Once the game starts, right-click and select Inspect” to open up Chrome DevTools, then select the Console tab.&lt;/p&gt;

&lt;p&gt;You can also do this by using the Ctrl+Shift+I shortcut, which takes you straight to the Console tab of DevTools.&lt;br&gt;
Open Chrome Console&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Make sure you are on the No Internet Connection page.&lt;/li&gt;
&lt;li&gt;  Right click anywhere on the page and select Inspect.&lt;/li&gt;
&lt;li&gt;  Go to Console tab. This is where we will enter the commands to tweak 
the game.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tweaking Speed&lt;/p&gt;

&lt;p&gt;Type the following command in Console and press enter. You can use any other speed in place of 1000.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Runner.instance_.setSpeed(1000)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Immortality&lt;/p&gt;

&lt;p&gt;After every command press enter. All the commands are case-sensitive.&lt;/p&gt;

&lt;p&gt;We store the original game over function in a variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var original = Runner.prototype.gameOver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we make the game over function empty:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runner.prototype.gameOver = function(){}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stopping the game after using Immortality&lt;/p&gt;

&lt;p&gt;When you want to stop the game, Revert back to the original game over function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runner.prototype.gameOver = original
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting the current score&lt;/p&gt;

&lt;p&gt;Let’s set the score to 12345. You can set any other score less than 99999. The current score is reset on game over.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runner.instance_.distanceRan = 12345 / Runner.instance_.distanceMeter.config.COEFFICIENT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dino jumping too high?&lt;/p&gt;

&lt;p&gt;You can control how high the dino jumps by using the below function. Adjust the value as necessary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runner.instance_.tRex.setJumpVelocity(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>chrome</category>
      <category>google</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Log : PHPExcel_Reader_Excel2007 Trying to access array offset on value of type null Line 1117</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Wed, 19 Feb 2025 10:24:38 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/log-phpexcelreaderexcel2007-trying-to-access-array-offset-on-value-of-type-null-line-1117-45im</link>
      <guid>https://forem.com/kevinmel2000/log-phpexcelreaderexcel2007-trying-to-access-array-offset-on-value-of-type-null-line-1117-45im</guid>
      <description>&lt;p&gt;Find the line of the error at the library file, in my case was some array that should not be null $attributes[$t] I've change it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if ($attributes['t'] == 'array') { //from this
if (isset($attributes['t']) &amp;amp;&amp;amp; $attributes['t'] == 'array') { //to this

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the error dissapeared.&lt;/p&gt;

</description>
      <category>php</category>
      <category>phpexcel</category>
    </item>
    <item>
      <title>Obfuscating “Hello world!” obfuscate on Python</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Thu, 02 Jan 2025 02:35:42 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/obfuscating-hello-world-obfuscate-on-python-16ll</link>
      <guid>https://forem.com/kevinmel2000/obfuscating-hello-world-obfuscate-on-python-16ll</guid>
      <description>&lt;p&gt;create the weirdest obfuscated program that prints the string “Hello world!”. I decided to write up an explanation of how the hell it works. So, here’s the entry, in Python 2.7:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(lambda _, __, ___, ____, _____, ______, _______, ________:
    getattr(
        __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
        ().__class__.__eq__.__class__.__name__[:__] +
        ().__iter__().__class__.__name__[_____:________]
    )(
        _, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                chr(___ % __) + _(_, __, ___ // __) if ___ else
                (lambda: _).func_code.co_lnotab,
            _ &amp;lt;&amp;lt; ________,
            (((_____ &amp;lt;&amp;lt; ____) + _) &amp;lt;&amp;lt; ((___ &amp;lt;&amp;lt; _____) - ___)) + (((((___ &amp;lt;&amp;lt; __)
            - _) &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt; ____) + (_ &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt;
            __) - _) &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; ___) + (_ &amp;lt;&amp;lt; _))) + (((_______
            &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_ &amp;lt;&amp;lt; ______) + _)) + (((_______ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt;
            ((_______ &amp;lt;&amp;lt; ___))) + (((_ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt;
            __) - _)) - (_______ &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; __) + _)) + (_______
            &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __))) - ((((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __) +
            _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt;
            (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; _))) + (((___ &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt;
            _))) + (_____ &amp;lt;&amp;lt; ______) + (_ &amp;lt;&amp;lt; ___)
        )
    )
)(
    *(lambda _, __, ___: _(_, __, ___))(
        (lambda _, __, ___:
            [__(___[(lambda: _).func_code.co_nlocals])] +
            _(_, __, ___[(lambda _: _).func_code.co_nlocals:]) if ___ else []
        ),
        lambda _: _.func_code.co_argcount,
        (
            lambda _: _,
            lambda _, __: _,
            lambda _, __, ___: _,
            lambda _, __, ___, ____: _,
            lambda _, __, ___, ____, _____: _,
            lambda _, __, ___, ____, _____, ______: _,
            lambda _, __, ___, ____, _____, ______, _______: _,
            lambda _, __, ___, ____, _____, ______, _______, ________: _
        )
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;String literals weren’t allowed, but I set some other restrictions for fun: it had to be a single expression (so no print statement) with minimal builtin usage and no integer literals.&lt;br&gt;
Getting started&lt;/p&gt;

&lt;p&gt;Since we can’t use print, we can write to the stdout file object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sys
sys.stdout.write("Hello world!\n")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But let’s use something lower-level: os.write(). We need stdout’s file descriptor, which is 1 (you can check with print sys.stdout.fileno()).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
os.write(1, "Hello world!\n")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We want a single expression, so we’ll use &lt;strong&gt;import&lt;/strong&gt;():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
__import__("os").write(1, "Hello world!\n")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also want to be able to obfuscate the write(), so we’ll throw in a getattr():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getattr(__import__("os"), "write")(1, "Hello world!\n")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the starting point. Everything from now on will be obfuscating the three strings and the int.&lt;br&gt;
Stringing together strings&lt;/p&gt;

&lt;p&gt;"os" and "write" are fairly simple, so we’ll create them by joining parts of the names of various built-in classes. There are many different ways to do this, but I chose the following:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"o" from the second letter of bool: True.__class__.__name__[1]
"s" from the third letter of list: [].__class__.__name__[2]
"wr" from the first two letters of wrapper_descriptor, an implementation detail in CPython found as the type of some builtin classes’ methods (more on that here): ().__class__.__eq__.__class__.__name__[:2]
"ite" from the sixth through eighth letters of tupleiterator, the type of object returned by calling iter() on a tuple: ().__iter__().__class__.__name__[5:8]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;We’re starting to make some progress!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
getattr(
    __import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
    ().__class__.__eq__.__class__.__name__[:2] +
    ().__iter__().__class__.__name__[5:8]
)(1, "Hello world!\n")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Hello world!\n" is more complicated. We’re going to encode it as a big integer, which will be formed of the ASCII code of each character multiplied by 256 to the power of the character’s index in the string. In other words, the following sum:&lt;br&gt;
∑n=0L−1cn(256n)&lt;/p&gt;

&lt;p&gt;where L&lt;br&gt;
is the length of the string and cn is the ASCII code of the n&lt;/p&gt;

&lt;p&gt;th character in the string. To create the number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; codes = [ord(c) for c in "Hello world!\n"]
&amp;gt;&amp;gt;&amp;gt; num = sum(codes[i] * 256 ** i for i in xrange(len(codes)))
&amp;gt;&amp;gt;&amp;gt; print num
802616035175250124568770929992
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need the code to convert this number back into a string. We use a simple recursive algorithm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; def convert(num):
...     if num:
...         return chr(num % 256) + convert(num // 256)
...     else:
...         return ""
...
&amp;gt;&amp;gt;&amp;gt; convert(802616035175250124568770929992)
'Hello world!\n'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rewriting in one line with lambda:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;convert = lambda num: chr(num % 256) + convert(num // 256) if num else ""

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we use anonymous recursion to turn this into a single expression. This requires a combinator. Start with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; comb = lambda f, n: f(f, n)
&amp;gt;&amp;gt;&amp;gt; convert = lambda f, n: chr(n % 256) + f(f, n // 256) if n else ""
&amp;gt;&amp;gt;&amp;gt; comb(convert, 802616035175250124568770929992)
'Hello world!\n'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we just substitute the two definitions into the expression, and we have our function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; (lambda f, n: f(f, n))(
...     lambda f, n: chr(n % 256) + f(f, n // 256) if n else "",
...     802616035175250124568770929992)
'Hello world!\n'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can stick this into our code from before, replacing some variable names along the way (f → &lt;em&gt;, n → _&lt;/em&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getattr(
    __import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
    ().__class__.__eq__.__class__.__name__[:2] +
    ().__iter__().__class__.__name__[5:8]
)(
    1, (lambda _, __: _(_, __))(
        lambda _, __: chr(__ % 256) + _(_, __ // 256) if __ else "",
        802616035175250124568770929992
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Function internals&lt;/p&gt;

&lt;p&gt;We’re left with a "" in the body of our convert function (remember: no string literals!), and a large number that we’ll have to hide somehow. Let’s start with the empty string. We can make one on the fly by examining the internals of some random function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; (lambda: 0).func_code.co_lnotab
''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we’re really doing here is looking at the line number table of the code object contained within the function. Since it’s anonymous, there are no line numbers, so the string is empty. Replace the 0 with _ to make it more confusing (it doesn’t matter, since the function’s not being called), and stick it in. We’ll also refactor out the 256 into an argument that gets passed to our obfuscated convert() along with the number. This requires adding an argument to the combinator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
getattr(
    __import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
    ().__class__.__eq__.__class__.__name__[:2] +
    ().__iter__().__class__.__name__[5:8]
)(
    1, (lambda _, __, ___: _(_, __, ___))(
        lambda _, __, ___:
            chr(___ % __) + _(_, __, ___ // __) if ___ else
            (lambda: _).func_code.co_lnotab,
        256,
        802616035175250124568770929992
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A detour&lt;/p&gt;

&lt;p&gt;Let’s tackle a different problem for a bit. We want a way to obfuscate the numbers in our code, but it’ll be cumbersome (and not particularly interesting) to recreate them each time they’re used. If we can implement, say, range(1, 9) == [1, 2, 3, 4, 5, 6, 7, 8], then we can wrap our current work in a function that takes variables containing the numbers from 1 to 8, and replace occurrences of integer literals in the body with these variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(lambda n1, n2, n3, n4, n5, n6, n7, n8:
    getattr(
        __import__(True.__class__.__name__[n1] + [].__class__.__name__[n2]),
        ...
    )(
        ...
    )
)(*range(1, 9))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though we need to form 256 and 802616035175250124568770929992 as well, these can be created using arithmetic operations on these eight “fundamental” numbers. The choice of 1–8 is arbitrary, but seems to be a good middle ground.&lt;/p&gt;

&lt;p&gt;We can get the number of arguments a function takes via its code object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; (lambda a, b, c: 0).func_code.co_argcount

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build a tuple of functions with argcounts between 1 and 8:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
funcs = (
    lambda _: _,
    lambda _, __: _,
    lambda _, __, ___: _,
    lambda _, __, ___, ____: _,
    lambda _, __, ___, ____, _____: _,
    lambda _, __, ___, ____, _____, ______: _,
    lambda _, __, ___, ____, _____, ______, _______: _,
    lambda _, __, ___, ____, _____, ______, _______, ________: _
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using a recursive algorithm, we can turn this into the output of range(1, 9):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; def convert(L):
...     if L:
...         return [L[0].func_code.co_argcount] + convert(L[1:])
...     else:
...         return []
...
&amp;gt;&amp;gt;&amp;gt; convert(funcs)
[1, 2, 3, 4, 5, 6, 7, 8]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As before, we convert this into lambda form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
convert = lambda L: [L[0].func_code.co_argcount] + convert(L[1:]) if L else []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, into anonymous-recursive form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; (lambda f, L: f(f, L))(
...     lambda f, L: [L[0].func_code.co_argcount] + f(f, L[1:]) if L else [],
...     funcs)
[1, 2, 3, 4, 5, 6, 7, 8]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For fun, we’ll factor out the argcount operation into an additional function argument, and obfuscate some variable names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
(lambda _, __, ___: _(_, __, ___))(
    (lambda _, __, ___:
        [__(___[0])] + _(_, __, ___[1:]) if ___ else []
    ),
    lambda _: _.func_code.co_argcount,
    funcs
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There’s a new problem now: we still need a way to hide 0 and 1. We can get these by examining the number of local variables within arbitrary functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; (lambda: _).func_code.co_nlocals
0
&amp;gt;&amp;gt;&amp;gt; (lambda _: _).func_code.co_nlocals
1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though the function bodies look the same, _ in the first function is not an argument, nor is it defined in the function, so Python interprets it as a global variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import dis
&amp;gt;&amp;gt;&amp;gt; dis.dis(lambda: _)
  1           0 LOAD_GLOBAL              0 (_)
              3 RETURN_VALUE
&amp;gt;&amp;gt;&amp;gt; dis.dis(lambda _: _)
  1           0 LOAD_FAST                0 (_)
              3 RETURN_VALUE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happens regardless of whether _ is actually defined in the global scope.&lt;/p&gt;

&lt;p&gt;Putting this into practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
(lambda _, __, ___: _(_, __, ___))(
    (lambda _, __, ___:
        [__(___[(lambda: _).func_code.co_nlocals])] +
        _(_, __, ___[(lambda _: _).func_code.co_nlocals:]) if ___ else []
    ),
    lambda _: _.func_code.co_argcount,
    funcs
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can substitute the value of funcs in, and then using * to pass the resulting list of integers as eight separate variables, we get this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
(lambda n1, n2, n3, n4, n5, n6, n7, n8:
    getattr(
        __import__(True.__class__.__name__[n1] + [].__class__.__name__[n2]),
        ().__class__.__eq__.__class__.__name__[:n2] +
        ().__iter__().__class__.__name__[n5:n8]
    )(
        n1, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                chr(___ % __) + _(_, __, ___ // __) if ___ else
                (lambda: _).func_code.co_lnotab,
            256,
            802616035175250124568770929992
        )
    )
)(
    *(lambda _, __, ___: _(_, __, ___))(
        (lambda _, __, ___:
            [__(___[(lambda: _).func_code.co_nlocals])] +
            _(_, __, ___[(lambda _: _).func_code.co_nlocals:]) if ___ else []
        ),
        lambda _: _.func_code.co_argcount,
        (
            lambda _: _,
            lambda _, __: _,
            lambda _, __, ___: _,
            lambda _, __, ___, ____: _,
            lambda _, __, ___, ____, _____: _,
            lambda _, __, ___, ____, _____, ______: _,
            lambda _, __, ___, ____, _____, ______, _______: _,
            lambda _, __, ___, ____, _____, ______, _______, ________: _
        )
    )
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shifting bits&lt;/p&gt;

&lt;p&gt;Almost there! We’ll replace the n{1..8} variables with &lt;em&gt;, _&lt;/em&gt;, &lt;strong&gt;&lt;em&gt;, _&lt;/em&gt;&lt;/strong&gt;, etc., since it creates confusion with the variables used in our inner functions. This doesn’t cause actual problems, since scoping rules mean the right ones will be used. This is also one of the reasons why we refactored 256 out to where _ refers to 1 instead of our obfuscated convert() function. It’s getting long, so I’ll paste only the first half:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
(lambda _, __, ___, ____, _____, ______, _______, ________:
    getattr(
        __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
        ().__class__.__eq__.__class__.__name__[:__] +
        ().__iter__().__class__.__name__[_____:________]
    )(
        _, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                chr(___ % __) + _(_, __, ___ // __) if ___ else
                (lambda: _).func_code.co_lnotab,
            256,
            802616035175250124568770929992
        )
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only two more things are left. We’ll start with the easy one: 256. 256=28&lt;/p&gt;

&lt;p&gt;, so we can rewrite it as 1 &amp;lt;&amp;lt; 8 (using a left bit shift), or _ &amp;lt;&amp;lt; ________ with our obfuscated variables.&lt;/p&gt;

&lt;p&gt;We’ll use the same idea with 802616035175250124568770929992. A simple divide-and-conquer algorithm can break it up into sums of numbers which are themselves sums of numbers that are shifted together, and so on. For example, if we had 112, we could break it up into 96 + 16 and then (3 &amp;lt;&amp;lt; 5) + (2 &amp;lt;&amp;lt; 3). I like using bit shifts because the &amp;lt;&amp;lt; reminds me of std::cout &amp;lt;&amp;lt; "foo" in C++, or print chevron (print &amp;gt;&amp;gt;) in Python, both of which are red herrings involving other ways of doing I/O.&lt;/p&gt;

&lt;p&gt;The number can be decomposed in a variety of ways; no one method is correct (after all, we could just break it up into (1 &amp;lt;&amp;lt; 0) + (1 &amp;lt;&amp;lt; 0) + ..., but that’s not interesting). We should have some substantial amount of nesting, but still use most of our numerical variables. Obviously, doing this by hand isn’t fun, so we’ll come up with an algorithm. In pseudocode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

func encode(num):
    if num &amp;lt;= 8:
        return "_" * num
    else:
        return "(" + convert(num) + ")"

func convert(num):
    base = shift = 0
    diff = num
    span = ...
    for test_base in range(span):
        for test_shift in range(span):
            test_diff = |num| - (test_base &amp;lt;&amp;lt; test_shift)
            if |test_diff| &amp;lt; |diff|:
                diff = test_diff
                base = test_base
                shift = test_shift
    encoded = "(" + encode(base) + " &amp;lt;&amp;lt; " + encode(shift) + ")"
    if diff == 0:
        return encoded
    else:
        return encoded + " + " + convert(diff)

convert(802616035175250124568770929992)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The basic idea here is that we test various combinations of numbers in a certain range until we come up with two numbers, base and shift, such that base &amp;lt;&amp;lt; shift is as closest to num as possible (i.e. we minimize their absolute difference, diff). We then use our divide-and-conquer algorithm to break up best_base and best_shift, and then repeat the procedure on diff until it reaches zero, summing the terms along the way.&lt;/p&gt;

&lt;p&gt;The argument to range(), span, represents the width of the search space. This can’t be too large, or we’ll end getting num as our base and 0 as our shift (because diff is zero), and since base can’t be represented as a single variable, it’ll repeat, recursing infinitely. If it’s too small, we’ll end up with something like the (1 &amp;lt;&amp;lt; 0) + (1 &amp;lt;&amp;lt; 0) + ... mentioned above. In practice, we want span to get smaller as the recursion depth increases. Through trial and error, I found this equation to work well:&lt;br&gt;
span=⌈log1.5|num|⌉+⌊24−depth⌋&lt;/p&gt;

&lt;p&gt;Translating the pseudocode into Python and making some tweaks (support for the depth argument, and some caveats involving negative numbers), we get this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from math import ceil, log

def encode(num, depth):
    if num == 0:
        return "_ - _"
    if num &amp;lt;= 8:
        return "_" * num
    return "(" + convert(num, depth + 1) + ")"

def convert(num, depth=0):
    result = ""
    while num:
        base = shift = 0
        diff = num
        span = int(ceil(log(abs(num), 1.5))) + (16 &amp;gt;&amp;gt; depth)
        for test_base in xrange(span):
            for test_shift in xrange(span):
                test_diff = abs(num) - (test_base &amp;lt;&amp;lt; test_shift)
                if abs(test_diff) &amp;lt; abs(diff):
                    diff = test_diff
                    base = test_base
                    shift = test_shift
        if result:
            result += " + " if num &amp;gt; 0 else " - "
        elif num &amp;lt; 0:
            base = -base
        if shift == 0:
            result += encode(base, depth)
        else:
            result += "(%s &amp;lt;&amp;lt; %s)" % (encode(base, depth),
                                      encode(shift, depth))
        num = diff if num &amp;gt; 0 else -diff
    return result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, when we call convert(802616035175250124568770929992), we get a nice decomposition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; convert(802616035175250124568770929992)
(((_____ &amp;lt;&amp;lt; ____) + _) &amp;lt;&amp;lt; ((___ &amp;lt;&amp;lt; _____) - ___)) + (((((___ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt; ____) + (_ &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; ___) + (_ &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_ &amp;lt;&amp;lt; ______) + _)) + (((_______ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt; ((_______ &amp;lt;&amp;lt; ___))) + (((_ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; __) - _)) - (_______ &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; __) + _)) + (_______ &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __))) - ((((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; _))) + (((___ &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt; _))) + (_____ &amp;lt;&amp;lt; ______) + (_ &amp;lt;&amp;lt; ___)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stick this in as a replacement for 802616035175250124568770929992, and put all the parts together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

(lambda _, __, ___, ____, _____, ______, _______, ________:
    getattr(
        __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
        ().__class__.__eq__.__class__.__name__[:__] +
        ().__iter__().__class__.__name__[_____:________]
    )(
        _, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                chr(___ % __) + _(_, __, ___ // __) if ___ else
                (lambda: _).func_code.co_lnotab,
            _ &amp;lt;&amp;lt; ________,
            (((_____ &amp;lt;&amp;lt; ____) + _) &amp;lt;&amp;lt; ((___ &amp;lt;&amp;lt; _____) - ___)) + (((((___ &amp;lt;&amp;lt; __)
            - _) &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt; ____) + (_ &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt;
            __) - _) &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; ___) + (_ &amp;lt;&amp;lt; _))) + (((_______
            &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_ &amp;lt;&amp;lt; ______) + _)) + (((_______ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt;
            ((_______ &amp;lt;&amp;lt; ___))) + (((_ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt;
            __) - _)) - (_______ &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; __) + _)) + (_______
            &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __))) - ((((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __) +
            _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt;
            (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; _))) + (((___ &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt;
            _))) + (_____ &amp;lt;&amp;lt; ______) + (_ &amp;lt;&amp;lt; ___)
        )
    )
)(
    *(lambda _, __, ___: _(_, __, ___))(
        (lambda _, __, ___:
            [__(___[(lambda: _).func_code.co_nlocals])] +
            _(_, __, ___[(lambda _: _).func_code.co_nlocals:]) if ___ else []
        ),
        lambda _: _.func_code.co_argcount,
        (
            lambda _: _,
            lambda _, __: _,
            lambda _, __, ___: _,
            lambda _, __, ___, ____: _,
            lambda _, __, ___, ____, _____: _,
            lambda _, __, ___, ____, _____, ______: _,
            lambda _, __, ___, ____, _____, ______, _______: _,
            lambda _, __, ___, ____, _____, ______, _______, ________: _
        )
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you have it.&lt;br&gt;
Addendum: Python 3 support&lt;/p&gt;

&lt;p&gt;Since writing this post, several people have asked about Python 3 support. I didn’t think of it at the time, but as Python 3 continues to gain traction (and thank you for that!), this post is clearly long overdue for an update.&lt;/p&gt;

&lt;p&gt;Fortunately, Python 3 (as of writing, 3.6) doesn’t require us to change much:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The func_code function object attribute has been renamed to __code__. Easy fix with a find-and-replace.
The tupleiterator type name has been changed to tuple_iterator. Since we use this to extract the substring "ite", we can get around this by changing our indexing in ().__iter__().__class__.__name__ from [_____:________] to [_:][_____:________].
os.write() requires bytes now instead of a str, so chr(...) needs to be changed to bytes([...]).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Here is the full Python 3 version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
(lambda _, __, ___, ____, _____, ______, _______, ________:
    getattr(
        __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
        ().__class__.__eq__.__class__.__name__[:__] +
        ().__iter__().__class__.__name__[_:][_____:________]
    )(
        _, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                bytes([___ % __]) + _(_, __, ___ // __) if ___ else
                (lambda: _).__code__.co_lnotab,
            _ &amp;lt;&amp;lt; ________,
            (((_____ &amp;lt;&amp;lt; ____) + _) &amp;lt;&amp;lt; ((___ &amp;lt;&amp;lt; _____) - ___)) + (((((___ &amp;lt;&amp;lt; __)
            - _) &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt; ____) + (_ &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt;
            __) - _) &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; ___) + (_ &amp;lt;&amp;lt; _))) + (((_______
            &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_ &amp;lt;&amp;lt; ______) + _)) + (((_______ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt;
            ((_______ &amp;lt;&amp;lt; ___))) + (((_ &amp;lt;&amp;lt; ____) - _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt;
            __) - _)) - (_______ &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt; __) + _)) + (_______
            &amp;lt;&amp;lt; (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __))) - ((((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; __) +
            _) &amp;lt;&amp;lt; ((((___ &amp;lt;&amp;lt; __) + _) &amp;lt;&amp;lt; _))) + (((_______ &amp;lt;&amp;lt; __) - _) &amp;lt;&amp;lt;
            (((((_ &amp;lt;&amp;lt; ___) + _)) &amp;lt;&amp;lt; _))) + (((___ &amp;lt;&amp;lt; ___) + _) &amp;lt;&amp;lt; ((_____ &amp;lt;&amp;lt;
            _))) + (_____ &amp;lt;&amp;lt; ______) + (_ &amp;lt;&amp;lt; ___)
        )
    )
)(
    *(lambda _, __, ___: _(_, __, ___))(
        (lambda _, __, ___:
            [__(___[(lambda: _).__code__.co_nlocals])] +
            _(_, __, ___[(lambda _: _).__code__.co_nlocals:]) if ___ else []
        ),
        lambda _: _.__code__.co_argcount,
        (
            lambda _: _,
            lambda _, __: _,
            lambda _, __, ___: _,
            lambda _, __, ___, ____: _,
            lambda _, __, ___, ____, _____: _,
            lambda _, __, ___, ____, _____, ______: _,
            lambda _, __, ___, ____, _____, ______, _______: _,
            lambda _, __, ___, ____, _____, ______, _______, ________: _
        )
    )
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for reading! I continue to be amazed by this post’s popularity.&lt;/p&gt;

</description>
      <category>python</category>
      <category>encryption</category>
      <category>obfuscate</category>
    </item>
    <item>
      <title>Secure Nginx with Let's Encrypt on Ubuntu</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Wed, 04 Dec 2024 08:01:18 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/secure-nginx-with-lets-encrypt-on-ubuntu-4p2g</link>
      <guid>https://forem.com/kevinmel2000/secure-nginx-with-lets-encrypt-on-ubuntu-4p2g</guid>
      <description>&lt;p&gt;Step 1 — Installing Certbot&lt;/p&gt;

&lt;p&gt;The first step to using Let’s Encrypt to obtain an SSL certificate is to install the Certbot software on your server.&lt;/p&gt;

&lt;p&gt;Install Certbot and it’s Nginx plugin with apt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo apt install certbot python3-certbot-nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Certbot is now ready to use, but in order for it to automatically configure SSL for Nginx, we need to verify some of Nginx’s configuration.&lt;br&gt;
Step 2 — Confirming Nginx’s Configuration&lt;/p&gt;

&lt;p&gt;Certbot needs to be able to find the correct server block in your Nginx configuration for it to be able to automatically configure SSL. Specifically, it does this by looking for a server_name directive that matches the domain you request a certificate for.&lt;/p&gt;

&lt;p&gt;If you followed the server block set up step in the Nginx installation tutorial, you should have a server block for your domain at /etc/nginx/sites-available/example.com with the server_name directive already set appropriately.&lt;/p&gt;

&lt;p&gt;To check, open the configuration file for your domain using nano or your favorite text editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo nano /etc/nginx/sites-available/example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find the existing server_name line. It should look like this:&lt;br&gt;
/etc/nginx/sites-available/example.com&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
server_name example.com www.example.com;
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it does, exit your editor and move on to the next step.&lt;/p&gt;

&lt;p&gt;If it doesn’t, update it to match. Then save the file, quit your editor, and verify the syntax of your configuration edits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo nginx -t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you get an error, reopen the server block file and check for any typos or missing characters. Once your configuration file’s syntax is correct, reload Nginx to load the new configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Certbot can now find the correct server block and update it automatically.&lt;/p&gt;

&lt;p&gt;Next, let’s update the firewall to allow HTTPS traffic.&lt;br&gt;
Step 3 — Allowing HTTPS Through the Firewall&lt;/p&gt;

&lt;p&gt;If you have the ufw firewall enabled, as recommended by the prerequisite guides, you’ll need to adjust the settings to allow for HTTPS traffic. Luckily, Nginx registers a few profiles with ufw upon installation.&lt;/p&gt;

&lt;p&gt;You can see the current setting by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will probably look like this, meaning that only HTTP traffic is allowed to the web server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Nginx HTTP                 ALLOW       Anywhere                  
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Nginx HTTP (v6)            ALLOW       Anywhere (v6)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To additionally let in HTTPS traffic, allow the Nginx Full profile and delete the redundant Nginx HTTP profile allowance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    sudo ufw allow 'Nginx Full'
    sudo ufw delete allow 'Nginx HTTP'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your status should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let’s run Certbot and fetch our certificates.&lt;br&gt;
Step 4 — Obtaining an SSL Certificate&lt;/p&gt;

&lt;p&gt;Certbot provides a variety of ways to obtain SSL certificates through plugins. The Nginx plugin will take care of reconfiguring Nginx and reloading the config whenever necessary. To use this plugin, type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo certbot --nginx -d example.com -d www.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This runs certbot with the --nginx plugin, using -d to specify the domain names we’d like the certificate to be valid for.&lt;/p&gt;

&lt;p&gt;If this is your first time running certbot, you will be prompted to enter an email address and agree to the terms of service. After doing so, certbot will communicate with the Let’s Encrypt server, then run a challenge to verify that you control the domain you’re requesting a certificate for.&lt;/p&gt;

&lt;p&gt;If that’s successful, certbot will ask how you’d like to configure your HTTPS settings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select your choice then hit ENTER. The configuration will be updated, and Nginx will reload to pick up the new settings. certbot will wrap up with a message telling you the process was successful and where your certificates are stored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem
   Your cert will expire on 2020-08-18. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Your certificates are downloaded, installed, and loaded. Try reloading your website using https:// and notice your browser’s security indicator. It should indicate that the site is properly secured, usually with a lock icon. If you test your server using the SSL Labs Server Test, it will get an A grade.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s finish by testing the renewal process.&lt;br&gt;
Step 5 — Verifying Certbot Auto-Renewal&lt;/p&gt;

&lt;p&gt;Let’s Encrypt’s certificates are only valid for ninety days. This is to encourage users to automate their certificate renewal process. The certbot package we installed takes care of this for us by adding a systemd timer that will run twice a day and automatically renew any certificate that’s within thirty days of expiration.&lt;/p&gt;

&lt;p&gt;You can query the status of the timer with systemctl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; sudo systemctl status certbot.timer

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;● certbot.timer - Run certbot twice daily
     Loaded: loaded (/lib/systemd/system/certbot.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Mon 2020-05-04 20:04:36 UTC; 2 weeks 1 days ago
    Trigger: Thu 2020-05-21 05:22:32 UTC; 9h left
   Triggers: ● certbot.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To test the renewal process, you can do a dry run with certbot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo certbot renew --dry-run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see no errors, you’re all set. When necessary, Certbot will renew your certificates and reload Nginx to pick up the changes. If the automated renewal process ever fails, Let’s Encrypt will send a message to the email you specified, warning you when your certificate is about to expire.&lt;/p&gt;

</description>
      <category>nginx</category>
      <category>https</category>
      <category>ssl</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Auto Deploy Laravel with Deployer.yml sample With Github Runner</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Wed, 04 Dec 2024 07:45:33 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/auto-deploy-deployeryml-sample-with-github-runner-536a</link>
      <guid>https://forem.com/kevinmel2000/auto-deploy-deployeryml-sample-with-github-runner-536a</guid>
      <description>&lt;p&gt;create a File Deployer.yml sample for github workflow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  push:
    branches:
      - main
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  CodeCheckout:
    # The type of runner that the job will run on
    runs-on: self-hosted

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v4

  CodeCheckout2:
    # The type of runner that the job will run on
    runs-on: self-hosted

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

  PullProject:
    needs: CodeCheckout
    runs-on: self-hosted
    steps:
      - name: Run project
        run: |
          cd /var/www/html/api_mobile/
          git -c credential.helper='!f() { echo "username=git username"; echo "password= git password(token pass)"; }; f' pull origin main

      # Runs a single command using the runners shell
      - name: Build assets
        run: npm install &amp;amp;&amp;amp; npm run build

      - name: Install PHP dependencies
        run: composer install --no-dev --optimize-autoloader

      - name: Clear cache
        run: php artisan clear-compiled

      - name: Recreate cache
        run: php artisan optimize

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Download&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a folder
&lt;/h1&gt;

&lt;p&gt;$ mkdir actions-runner &amp;amp;&amp;amp; cd actions-runner&lt;/p&gt;

&lt;h1&gt;
  
  
  Download the latest runner package
&lt;/h1&gt;

&lt;p&gt;$ curl -o actions-runner-linux-x64-2.320.0.tar.gz -L &lt;a href="https://github.com/actions/runner/releases/download/v2.320.0/actions-runner-linux-x64-2.320.0.tar.gz" rel="noopener noreferrer"&gt;https://github.com/actions/runner/releases/download/v2.320.0/actions-runner-linux-x64-2.320.0.tar.gz&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Optional: Validate the hash
&lt;/h1&gt;

&lt;p&gt;$ echo "93ac1b7ce743ee85b5d386f5c1787385ef07b3d7c728ff66ce0d3813d  actions-runner-linux-x64-2.320.0.tar.gz" | shasum -a 256 -c&lt;/p&gt;

&lt;h1&gt;
  
  
  Extract the installer
&lt;/h1&gt;

&lt;p&gt;$ tar xzf ./actions-runner-linux-x64-2.320.0.tar.gz&lt;/p&gt;

&lt;p&gt;Configure&lt;/p&gt;

&lt;h1&gt;
  
  
  Create the runner and start the configuration experience:
&lt;/h1&gt;

&lt;p&gt;export RUNNER_ALLOW_RUNASROOT="1"&lt;/p&gt;

&lt;p&gt;RUNNER_ALLOW_RUNASROOT="1" ./config.sh --url &lt;a href="https://github.com/repo" rel="noopener noreferrer"&gt;https://github.com/repo&lt;/a&gt; --token BLLCPCGOV5JBDIDVTN45333HFM&lt;/p&gt;

&lt;h1&gt;
  
  
  Last step, run it!:
&lt;/h1&gt;

&lt;p&gt;RUNNER_ALLOW_RUNASROOT="1" ./run.sh &amp;amp;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>github</category>
      <category>cicd</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Managing Docker Containers with Portainer</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Wed, 20 Nov 2024 02:36:45 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/managing-docker-containers-with-portainer-40ei</link>
      <guid>https://forem.com/kevinmel2000/managing-docker-containers-with-portainer-40ei</guid>
      <description>&lt;p&gt;Portainer is a web-based container management platform that supports Docker, Swarm, Nomad, and Kubernetes. Portainer is available in two versions, Community Edition (CE) and Business Edition (BE).&lt;br&gt;
Tutorial Environment&lt;/p&gt;

&lt;p&gt;Environment used in this tutorial:&lt;/p&gt;

&lt;p&gt;VPS Ubuntu 20.04&lt;br&gt;
Docker v20.10&lt;br&gt;
Portainer CE v2.13&lt;/p&gt;

&lt;p&gt;Install Portainer Server&lt;/p&gt;

&lt;p&gt;Before installing Portainer Server, install Docker first.&lt;/p&gt;

&lt;p&gt;Create a volume to store the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker volume create portainer_data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a container named portainer from the docker volume create portainer_data image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checking whether the Portainer Server container is running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example of the command results above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
11f1ae8a0d4a portainer/portainer-ce:latest "/portainer" About a minute ago Up About a minute 0.0.0.0:8000-&amp;gt;8000/tcp, :::8000-&amp;gt;8000/tcp, 0.0.0.0:9443-&amp;gt;9443/tcp, :::9443-&amp;gt;9443/tcp, 9000/tcp portainer

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initial Setup&lt;/p&gt;

&lt;p&gt;Browse Portainer Server at &lt;a href="https://ServerIP:9443" rel="noopener noreferrer"&gt;https://ServerIP:9443&lt;/a&gt;. Enter Username and Password for administrator.&lt;/p&gt;

&lt;p&gt;If Portainer times out when first accessed, restart the Portainer container. Timeouts occur because the wait time runs out, Portainer is not immediately accessed when the container is finished being created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker stop portainer
docker start portainer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Portainer dashboard after login.&lt;/p&gt;

</description>
      <category>docker</category>
    </item>
    <item>
      <title>Nginx force http to https On 443 https Port</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Fri, 08 Nov 2024 04:24:55 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/nginx-force-http-to-https-on-443-https-port-5e3n</link>
      <guid>https://forem.com/kevinmel2000/nginx-force-http-to-https-on-443-https-port-5e3n</guid>
      <description>&lt;p&gt;sample script nginx :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server 
{

        listen 443 default ssl;
        listen [::]:443 ssl;
        root /var/www/html/api_mobile/public;

        include snippets/ssl-params.conf;

        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-Content-Type-Options "nosniff";
        index index.html index.php index.htm index.nginx-debian.html;

        server_name sitename.com;

        charset utf-8;
        location / {
             if ($scheme ="http") {
                # redirect all non api traffic to https block
                return 301 https://$server_name$request_uri;
             }           

            try_files $uri $uri/ /index.php?$query_string;
        }

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }


        error_page 404 /index.php;
        location ~ \.php$ {
            fastcgi_pass unix:/run/php/php8.2-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;
        }

    ssl_certificate /etc/letsencrypt/live/sites/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/site/privkey.pem; # managed by Certbot
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;point on scheme condition :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if ($scheme ="http") 
{
                # redirect all non api traffic to https block
                return 301 https://$server_name$request_uri;
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it core of redirect on one port 443 https force http to https&lt;/p&gt;

</description>
      <category>nginx</category>
      <category>php</category>
    </item>
    <item>
      <title>Java FTPS disabling Certificate Check , FOR FIX FTP SSL certificate expired exception</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Tue, 26 Mar 2024 08:00:02 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/java-ftps-disabling-certificate-check-for-fix-ftp-ssl-certificate-expired-exception-3ko6</link>
      <guid>https://forem.com/kevinmel2000/java-ftps-disabling-certificate-check-for-fix-ftp-ssl-certificate-expired-exception-3ko6</guid>
      <description>&lt;p&gt;1)the encryption of the FTPS server will be either TLS explicit encryption or TLS explicit encryption.Use the constructor arg for FTPS accordingly. like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FTPSClient ftpClient = new FTPSClient(false);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2)if your FTPS server security certificate has expired, disable the check from client by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ftpClient.setTrustManager(new X509TrustManager() {
    @Override
    public X509Certificate[] getAcceptedIssuers() {
        return null;
    }

    @Override
    public void checkClientTrusted(X509Certificate[] certs, String authType) {
    }

    @Override
    public void checkServerTrusted(X509Certificate[] certs, String authType) {
    }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3)enable file transfer between server and client using this method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ftpClient.enterLocalPassiveMode();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4)use the right port number. Usually for explicit encryption it is 21 and for implicit it is 990&lt;/p&gt;

&lt;p&gt;The above four are the common configs required to establish a connection. The end snippet looks something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
FTPSClient ftpClient = new FTPSClient(false);
        ftpClient.setTrustManager(new X509TrustManager() {
            @Override
            public X509Certificate[] getAcceptedIssuers() {
                return null;
            }

            @Override
            public void checkClientTrusted(X509Certificate[] certs, String authType) {
            }

            @Override
            public void checkServerTrusted(X509Certificate[] certs, String authType) {
            }
        });
        ftpClient.connect("ftps.mydomain.com",21);
        boolean res = ftpClient.login("username", "password");
        if(!res) throw new Exception("unable to connect to ftps");
        int reply=ftpClient.getReplyCode();
        if(FTPReply.isPositiveCompletion(reply)){
            ftpClient.enterLocalPassiveMode();
            FTPFile[] ftpFiles = ftpClient.listFiles("/folder/subfolder");
            System.out.println("complete "+reply+" "+ftpFiles.length);
            for(FTPFile x: ftpFiles){
                System.out.println(x.getName());
            }
            ftpClient.retrieveFile("/folder/subfolder/file.tsv",new FileOutputStream(new File("C:\\Users\\myname\\Desktop\\out.csv")));
        }else{
            throw new RuntimeException("unable to get valid reply from ftp server. Reply code is "+reply);
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>sftp</category>
    </item>
    <item>
      <title>GIS MAP Leaflet JS with OPENSTREETMAP SAMPLE</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Fri, 26 Jan 2024 08:14:06 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/gis-map-leaflet-js-with-openstreetmap-sample-46n1</link>
      <guid>https://forem.com/kevinmel2000/gis-map-leaflet-js-with-openstreetmap-sample-46n1</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;base target="_top"&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;

    &amp;lt;title&amp;gt;Quick Start - Leaflet&amp;lt;/title&amp;gt;

    &amp;lt;link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" /&amp;gt;

    &amp;lt;link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/&amp;gt;
    &amp;lt;script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        html, body {
            height: 100%;
            margin: 0;
        }
        .leaflet-container {
            height: 400px;
            width: 600px;
            max-width: 100%;
            max-height: 100%;
        }
    &amp;lt;/style&amp;gt;


&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;



&amp;lt;div id="map" style="width: 600px; height: 400px;"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script&amp;gt;

    const map = L.map('map').setView([51.505, -0.09], 13);

    const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
        maxZoom: 19,
        attribution: '&amp;amp;copy; &amp;lt;a href="http://www.openstreetmap.org/copyright"&amp;gt;OpenStreetMap&amp;lt;/a&amp;gt;'
    }).addTo(map);

    const marker = L.marker([51.5, -0.09]).addTo(map)
        .bindPopup('&amp;lt;b&amp;gt;Hello world!&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;I am a popup.').openPopup();

    const circle = L.circle([51.508, -0.11], {
        color: 'red',
        fillColor: '#f03',
        fillOpacity: 0.5,
        radius: 500
    }).addTo(map).bindPopup('I am a circle.');

    const polygon = L.polygon([
        [51.509, -0.08],
        [51.503, -0.06],
        [51.51, -0.047]
    ]).addTo(map).bindPopup('I am a polygon.');


    const popup = L.popup()
        .setLatLng([51.513, -0.09])
        .setContent('I am a standalone popup.')
        .openOn(map);

    function onMapClick(e) {
        popup
            .setLatLng(e.latlng)
            .setContent(`You clicked the map at ${e.latlng.toString()}`)
            .openOn(map);
    }

    map.on('click', onMapClick);

&amp;lt;/script&amp;gt;



&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>GIS MAP Leaflet JS with API MAPBOX SAMPLE</title>
      <dc:creator>Teddy Zugana</dc:creator>
      <pubDate>Fri, 26 Jan 2024 08:05:55 +0000</pubDate>
      <link>https://forem.com/kevinmel2000/gis-map-leaflet-js-with-api-mapbox-178a</link>
      <guid>https://forem.com/kevinmel2000/gis-map-leaflet-js-with-api-mapbox-178a</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Multiple Marker LeafletJS&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""&amp;gt;
    &amp;lt;script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;style&amp;gt;
        html, body {
            height: 100%;
            margin: 0;
        }

        #map {
            width: 600px;
            height: 400px;
        }

        body {
            padding: 0; margin: 0;
        }

        #map {
            height: 100%; width: 100vw;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script type="text/javascript"&amp;gt;
        var mymap = L.map('map', { zoomControl: false }).setView([-6.869544, 109.3948958], 13);

        L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=sk.eyJ1Ijoia2V2aW5tZWwyMDAwIiwiYSI6ImNscnVjamoyZzA5M20ybXBxODg5ZzB4NnUifQ.YaAZJsy4wgx7bYpnvQFFaw', {
            maxZoom: 18,
            attribution: 'Map data © OpenStreetMap contributors.',
            id: 'mapbox/streets-v11',
            tileSize: 512,
            zoomOffset: -1
        }).addTo(mymap);

        L.marker([-6.859829, 109.378317]).bindPopup('Pantai Widuri').addTo(mymap);
        L.marker([-6.869374, 109.394864]).bindPopup('Nilla Collection').addTo(mymap);
        L.marker([-6.890105, 109.380705]).bindPopup('Alun-Alun Pemalang').addTo(mymap);
        L.marker([-6.888103, 109.386499]).bindPopup('Hotel Kencana Pemalang').addTo(mymap);
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>gis</category>
      <category>leafletjs</category>
      <category>mapbox</category>
    </item>
  </channel>
</rss>
