Skip to content

Commit e09ca6e

Browse files
committed
Sync Post at Thu 18 Jun 2026 15:11:03 WIB
1 parent 4ba0d33 commit e09ca6e

14 files changed

Lines changed: 3950 additions & 0 deletions

‎content/posts/38352adc-95ea-8071-9b53-fde3617af3c7.md‎

Lines changed: 1300 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "🛜 OpenWRT"
3+
date: "2023-02-25T20:51:00.000Z"
4+
last_edited_time: "2024-04-04T02:24:00.000Z"
5+
draft: false
6+
---
7+
8+
![Wireless Router with Ethernet Port (Unsplash)](https://radito.vercel.app/b9292d947d28610e2b2bb216f6a83722c8064d7fa3a5a76a0067e88c7f220c0c/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f6839746c73676534316b79706d6863723139657a632f383635326663376665346233646134383263643163333432646462646433343332646666353935316530376261396237383236633136336536373239333637312e6a70673f726c6b65793d3666746e3339646f396a63657a77726261627265656d71313426646c3d30267261773d31)
9+
10+
11+
OpenWRT is a Linux-based open-source operating system designed for embedded devices such as routers. It is a free and customizable firmware that allows users to modify and extend the functionality of their routers beyond what the manufacturer provides. OpenWRT is popular among tech enthusiasts, developers, and network administrators due to its flexibility, stability, and security features.
12+
13+
14+
## Features
15+
16+
17+
OpenWRT comes with a range of features that make it a popular choice for embedded devices. Some notable features include:
18+
19+
- **Package Management:** OpenWRT has a built-in package management system that allows users to install, update, and remove software packages easily. This feature makes it easy for users to customize their routers according to their needs.
20+
- **Security:** OpenWRT comes with several security features, including a built-in firewall, VPN support, and support for encryption protocols. These features help to secure your network and protect your data from unauthorized access.
21+
- **Customization:** OpenWRT is highly customizable, allowing users to configure their routers to their specific needs. Users can modify the source code, install custom software packages, and even create their own firmware images.
22+
- **Stability:** OpenWRT is known for its stability and reliability. It is designed to run for long periods without crashing, which makes it ideal for critical applications.
23+
24+
## Benefits
25+
26+
27+
OpenWRT has several benefits, including:
28+
29+
- **Flexibility:** With OpenWRT, users have complete control over their routers. They can customize their routers to their specific needs and even add new features.
30+
- **Security:** OpenWRT comes with several security features that help to protect your network and data from cyber threats.
31+
- **Stability:** OpenWRT is designed to run for long periods without crashing, which makes it ideal for critical applications.
32+
- **Community Support:** OpenWRT has a large and active community of developers and users who provide support, share knowledge, and contribute to the development of the firmware.
33+
34+
## Conclusion
35+
36+
37+
OpenWRT is a powerful and flexible firmware that offers users complete control over their routers. With its built-in package management system, security features, and customization options, OpenWRT is a popular choice for tech enthusiasts, developers, and network administrators. Its stability and reliability make it ideal for critical applications, while its active community provides support and contributes to its development.
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
title: "⛔️ Async Error Handling di TypeScript"
3+
date: "2023-12-30T05:20:00.000Z"
4+
last_edited_time: "2024-04-04T02:25:00.000Z"
5+
draft: false
6+
---
7+
8+
Pada project yang menggunakan bahasa Typescript atau Javascript modern, penggunaan promise dan sistem asinkronus sudah banyak digunakan secara umum. Fitur asinkron dalam pemrograman memungkinkan eksekusi beberapa tugas secara bersamaan tanpa harus menunggu tugas satu selesai sebelum tugas lainnya dimulai.
9+
10+
11+
Dalam konteks JavaScript dan TypeScript, salah cara utama untuk mengelola operasi asinkron adalah menggunakan Promise. Promise adalah objek yang merepresentasikan nilai yang mungkin akan tersedia di masa depan, atau mungkin tidak tersedia sama sekali. Ide dasar di balik Promise adalah bahwa suatu operasi asinkron dapat memiliki dua hasil: berhasil atau gagal.
12+
13+
14+
Pada artikel ini, akan dibahas konsep untuk error handling dalam kode asinkronus menggunakan TypeScript. Pada implementasinya akan menggunakan `async/await` untuk membuat kode lebih mudah dibaca dan strategi untuk menangani kesalahan yang muncul selama operasi asinkron.
15+
16+
17+
### Kode Error Handling
18+
19+
20+
```typescript
21+
type TryPromiseReturn<T, U> = Promise<[U, undefined] | [null, T]>;
22+
23+
function tryPromise<T, U extends Error>(promiseHandle: Promise<T>): TryPromiseReturn<T, U> {
24+
return promiseHandle
25+
.then<[null, T]>((data: T) => [null, data])
26+
.catch<[U, undefined]>((err: U) => [err, undefined]);
27+
}
28+
29+
export { tryPromise };
30+
```
31+
32+
33+
Kode diatas merupakan function di typescript yang digunakan untuk mengatasi error. Pada function diatas didefinisikan `tryPromise` dengan parameter `Promise<T>` dengan tipe generic sehingga dapat menerima semua return type promise yang dimasukkan pada parameternya.
34+
35+
36+
Kemudian di dalam function `tryPromise` dilakukan handling promise seperti pada biasanya menggunakan callback then dan catch, callback then digunakan ketika promise berhasil dijalankan dan tidak ada error di dalamnya. Callback ini menggunakan paramter data dengan tipe generic turunan dari argument `Promise<T>` sehingga tipenya akan sama dengan return dari hasil promiseHandle.
37+
38+
39+
Jika promise berhasil maka akan dikembalikan keluaran berbentuk array format array dengan hasil kembalian seperti dibawah
40+
41+
42+
→ Kondisi sukses
43+
44+
45+
`[error: null, data: ...]`
46+
47+
→ Kondisi Error
48+
49+
50+
`[error: ..., data:null]`
51+
52+
53+
Data merupakan array dengan index ke [1] sedangkan error berada pada array dengan index ke [0] dengan struktur seperti diatas dengan mudah data array dapat dilakukan destructuring menggunakan fungsi destruktur array pada javascript dan dapat langsung disimpan pada variable yang akan digunakan.
54+
55+
56+
### Penggunaan Kode
57+
58+
59+
Ada skenario dimana sebuah program melakukan request ke external API untuk mendapatkan data json. Pada proses yang dijalankan banyak sekali error yang akan dihadapi maupun error yang tidak terduga yang dapat terjadi sewaktu waktu seperti:
60+
61+
- Koneksi gagal sehingga request tidak terkirim
62+
- HTTP 500 Internal Server Error
63+
- Gateway Timeout
64+
- Invalid Json
65+
- dll
66+
67+
→ Handling error menggunakan Try Catch ❌
68+
69+
70+
```typescript
71+
import { tryPromise } from "../../lib/utils/helpers";
72+
73+
async function fetchData(query: string): Promise<object | null> {
74+
const fetchUrl = `/api/data?q=${encodeURIComponent(query)}`;
75+
76+
let fetchJson = null;
77+
78+
try {
79+
const fetchCtx = await fetch(fetchUrl, {
80+
method: "GET",
81+
mode: "cors",
82+
credentials: "include",
83+
body: null,
84+
});
85+
86+
if (!fetchCtx.ok) {
87+
const fetchStatus = fetchCtx.statusText;
88+
console.log(fetchStatus);
89+
return null;
90+
}
91+
92+
fetchJson = await fetchCtx.json();
93+
94+
} catch (err) {
95+
console.log(err);
96+
}
97+
98+
return fetchJson;
99+
}
100+
```
101+
102+
103+
Penggunaan error handling menggunakan try catch hasilnya akan mengcover seluruh blok pada kode. Dengan menggunakan try catch kita dipaksa untuk memasukkan seluruh blok kode di dalam statement tersebut akhirnya kode yang dihasilkan menjadi susah untuk dimaintain dan susah untuk dibaca, karena bisa saja error terjadi di bagian kode mana saja dan tidak ada handling spesifik untuk function tertentu.
104+
105+
106+
→ Handling error menggunakan tryPromise ✅
107+
108+
109+
```typescript
110+
import { tryPromise } from "../../lib/utils/helpers";
111+
112+
async function fetchData(query: string): Promise<object | null> {
113+
const fetchUrl = `/api/data?q=${encodeURIComponent(query)}`;
114+
115+
const [errFetchCtx, fetchCtx] = await tryPromise(
116+
fetch(fetchUrl, {
117+
method: "GET",
118+
mode: "cors",
119+
credentials: "include",
120+
body: null,
121+
})
122+
);
123+
124+
if (errFetchCtx) {
125+
console.log("Error when executing fetch ", errFetchCtx);
126+
return null;
127+
}
128+
129+
if (!fetchCtx.ok) {
130+
const fetchStatus = fetchCtx.statusText;
131+
console.log(fetchStatus);
132+
return null;
133+
}
134+
135+
const [errFetchJson, fetchJson] = await tryPromise(fetchCtx.json());
136+
137+
if (errFetchJson) {
138+
console.log("Error when parsing JSON response");
139+
return null;
140+
}
141+
142+
return fetchJson;
143+
}
144+
```
145+
146+
147+
Jika function tryPromise digunakan, maka handling error dapat dilakukan pada setiap function yang akan dipanggil. Sehingga kode yang ditulis akan mudah terbaca, selain itu akan terlihat jelas dimana function tersebut dipanggil dan dimana error dari function tersebut akan terjadi.
148+
149+
150+
Sehingga kita tidak perlu memasukkan seluruh blok kode ke dalam function try catch hanya untuk menghandle satu error yang ada pada function, serta kondisi error handling tiap promise dapat berbeda beda dan bisa disesuaikan sesuai kebutuhan apakah error tersebut perlu penanganan lanjutan pada saat pengecekannya.
151+
152+
153+
### Penutup
154+
155+
156+
Ada banyak cara untuk menangani error pada program, entah itu error atau tidak karena hanya programmer yang dapat mendefinisikannya. Pada sejatinya error adalah sebuah value / nilai dan sebagai programmer adalah bagaimana kita menangani error tersebut atau mengabaikannya. Untuk solusi tryPromise memang banyak terinsipirasi dari penanganan error dari bahasa Go karena dalam Golang penanganan error merupakan hal yang dibuat secara simple tidak perlu membutuhkan blok penanganan yang lebih lanjut. Error pada golang dihandle layaknya variable adalah sebuah nilai yang di definisikan oleh programmer.
157+
158+
159+
Tidak ada cara yang sepenuhnya benar untuk menangani error, penggunaan try catch akan lebih sesuai pada use case tertentu sehingga penggunaan tryPromise malah akan mempersulit. Oleh karena itu, gunakanlah cara dan metode sesuai kebuhan anda.
160+
161+
162+
### Referensi
163+
164+
165+
[https://go.dev/blog/error-handling-and-go](https://go.dev/blog/error-handling-and-go)
166+
167+
168+
[https://github.com/scopsy/await-to-js](https://github.com/scopsy/await-to-js)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: "⚡️ Overclock Bolt BL-100/BL-201 (Mediatek MT7620A)"
3+
date: "2023-03-14T23:50:00.000Z"
4+
last_edited_time: "2024-04-04T02:24:00.000Z"
5+
draft: false
6+
---
7+
8+
Overclocking Router adalah proses meningkatkan kecepatan clock CPU router melebihi pengaturan default pabrik. CPU adalah "otak" router, bertanggung jawab untuk melakukan perhitungan dan mengelola lalu lintas jaringan. Dengan mempercepat CPU, pengguna dapat meningkatkan kemampuan pemrosesan router, yang dapat menghasilkan kecepatan jaringan yang lebih cepat dan performa yang lebih baik.
9+
10+
11+
Namun, overclocking router tidak disarankan bagi sebagian besar pengguna karena dapat membatalkan garansi router dan berpotensi merusak hardware. Overclocking juga dapat meningkatkan output panas router, yang dapat menyebabkan masalah stabilitas dan bahkan kegagalan hardware jika tidak dikelola dengan baik.
12+
13+
14+
Bagi yang masih tertarik melakukan overclocking pada router, penting untuk dicatat bahwa proses ini dapat bervariasi tergantung pada merek dan model router. Pengguna juga harus memiliki pengalaman dengan hardware komputer dan mengenal risiko yang terkait dengan overclocking.
15+
16+
17+
> 💡 Untuk melakukan overclocking pastikan anda sudah menginstall Bootloader Breed. Jika belum cek tutorialnya di artikel ini untuk melakukan instalasi OpenWRT + Breed → [**LINK**](https://radito.github.io/posts/bd5a426b-d8e8-4ab6-a30f-4e0e58664933/)
18+
19+
20+
# Bahan Yang Diperlukan
21+
22+
1. Router Bolt BL-100/BL-201
23+
2. Kabel Lan RJ-45 / UTP
24+
25+
# Langkah Overclocking
26+
27+
28+
1. Colokkan router dengan pc dengan kabel RJ-45, Lalu set ip static di pc anda. Karena IP Default Breed adalah `192.168.1.1` Maka anda dapat menggunakan ip di subnet `192.168.1.0/24` .
29+
30+
31+
Sebagai Contoh disini saya menggunakan konfigurasi
32+
33+
34+
`IP Address : 192.168.1.9`
35+
36+
37+
`Subnet Mask : 255.255.255.0`
38+
39+
40+
`Default Gateway: Kosongkan`
41+
42+
43+
![](https://radito.vercel.app/5b0839511427a5c8b67139375e301c6351a297a29a43b4e16bbb729f120d02e1/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f7a727a62677438303365726d6f3579767a76306e6d2f383862383761303532373763383265386534323738316536316639326133383964303036383763386534346437376236646366323763616665373735663336372e706e673f726c6b65793d696b363970666364686d746162336363747670616e31766d3126646c3d30267261773d31)
44+
45+
46+
2. Setelah itu buka web browser dan nyalakan router anda. Ketika router booting langsung akses link berikut untuk masuk ke bootloader
47+
48+
49+
[`http://192.168.1.1/bootcfg.html`](http://192.168.1.1/bootcfg.html)
50+
51+
52+
Anda hanya punya waktu **~5 detik** untuk mengakses link dan menghentikan proses boot, jika gagal maka matikan router lalu ulangi step diatas. Jika berhasil maka akan ditampilkan tampilan berikut
53+
54+
55+
![](https://radito.vercel.app/c1684dcdede631376b8a4cb35db98d1b5a5fa980736d9c6c84d2d0c573dd1978/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f6b666372306479386c793562657234356d387636752f303261323139376434386464346266386234333761333531333935646164646338656338633135333735313834656632666239656538636634313163303234332e706e673f726c6b65793d797a36717a3865733675726f366e77783868776c706435623726646c3d30267261773d31)
56+
57+
58+
3. Pergi ke menu dibawah ini untuk masuk ke menu overclocking [`http://192.168.1.1/bootcfg.html`](http://192.168.1.1/bootcfg.html)
59+
60+
61+
![](https://radito.vercel.app/e70cd3a355a63935efaa00071c7a626df821384caed7369d2be59ca72abb3f9b/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f30626178616f657033706b773866683976647171742f363932626463323435326630636566313965383137646434306138316535393362393931383734316232393133326231306131626434636334613561303761382e706e673f726c6b65793d62386562647937693973317478737a376a6e7a6f307470357426646c3d30267261773d31)
62+
63+
64+
4. Akan muncul detail frekuensi kerja prosesor, disini anda bisa bereksperimen dengan mengubah2 nilai yang ada.
65+
66+
67+
![](https://radito.vercel.app/83f0b63c11a8b4fdbe692111c25f7a849edc3e659604e3f85fe067417b096fb0/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f386f6d67326c35337861776f357732706e626a706c2f346665316233306231616337623936323364326532653231656362643136656138353164336435323339393765623862386163386632616263343431353136632e706e673f726c6b65793d356e333970727875346d37356966377339733635637572706c26646c3d30267261773d31)
68+
69+
70+
5. Sebagai contoh saya mengubah angka pengali menjadi 31 dan clockspeed bertambah menjadi 620 Mhz. Jika sudah klik button dibawah maka pengaturan akan disimpan.
71+
72+
73+
![](https://radito.vercel.app/4c87a5498afce0f3f164c39c3485a7c92d3452603164966c94d1789c24f66d99/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f6d76786d7734367074353637627737647a6733616e2f366366383362643965326539326439626531383130376337373063373933303762333063363733363838643864393333366430383537393666333637303433312e706e673f726c6b65793d6f6d70363879306c68766f313835667161697475656174643826646c3d30267261773d31)
74+
75+
76+
7. Terakhir kita reboot routernya, dan akan otomatis masuk ke clockspeed yang terbaru.
77+
78+
79+
![](https://radito.vercel.app/2e984af4f5145dae51fdbeb592fb5f6cc4183b355cf9394e69392d0816c0170c/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f636b3968726265783073636375786a663377736d6c2f373837643731653366306533383665666635656663653061623733636133636439643733653664343866306433643337323763336565636532663539363633362e706e673f726c6b65793d3339386575353261376637673463716963746467706675333226646c3d30267261773d31)
80+
81+
82+
![](https://radito.vercel.app/c303836a7fc72986036b87b1b35a99811b6027a12db5d8b6afe23e6f1fbd6cf5/68747470733a2f2f7777772e64726f70626f782e636f6d2f73636c2f66692f6b38396268336537646476366d386e7666763265732f663330313934653235396362373838616165666234656264653537633737353736663138326461326635636563333432346162303539323865323739343066352e706e673f726c6b65793d7071627971726974776772376474766333353230777736677626646c3d30267261773d31)

0 commit comments

Comments
 (0)