Skip to content

Instantly share code, notes, and snippets.

View tfkhdyt's full-sized avatar
🇵🇸
Free Palestine

Taufik Hidayat tfkhdyt

🇵🇸
Free Palestine
View GitHub Profile
@tfkhdyt
tfkhdyt / create-fiber-app
Last active March 8, 2024 02:42
Create Fiber App
#!/usr/bin/bash
set -euo pipefail
printf "Package name? "
read -r PACKAGE_NAME
if [[ -z "$PACKAGE_NAME" ]]; then
echo "Error: package name should not be empty"
exit 1
fi
@tfkhdyt
tfkhdyt / ws.js
Last active January 24, 2024 00:06
Node.js websocket example
const WebSocket = require("ws");
const ws = new WebSocket("wss://xapi.netovas.app/auth/inspect/ws");
ws.on("error", console.error);
ws.on("open", () => {
ws.send(
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDY2MjE0MjAsImlkIjoxNzAzMDY5NDU4NTcyLCJyb2xlIjoicGFydG5lciJ9.m3h_XqTI-aGZPS4obnoKVfivDXy0cnVIQnoqQlqZNVA",
);
@tfkhdyt
tfkhdyt / another-example.conf
Last active January 28, 2024 08:21
NGINX Reverse Proxy
server {
server_name api.gananwo.click;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
@tfkhdyt
tfkhdyt / yuuko-alert.sh
Created December 25, 2023 00:46
Yuuko Alert
#!/usr/bin/env bash
yad \
--info --text 'Selamat Pagi !' --title 'Yuuko Alert' \
--image './yuuko_selamat_pagi_greeting-75.png' --button="OK:0" \
--width 200 --height 150 --text-align 'center' --buttons-layout 'center' \
--center
@tfkhdyt
tfkhdyt / service-name.service
Created February 8, 2023 01:34
Simple Systemd service example
[Unit]
Description=Service description
[Service]
Type=simple
User=admin
WorkingDirectory=/home/admin/project-name
ExecStart=/usr/bin/node /home/admin/project-name/dist/index.js
Restart=on-failure
@tfkhdyt
tfkhdyt / programs-that-i-use-everyday.md
Last active January 26, 2023 23:58
Programs that I use everyday
@tfkhdyt
tfkhdyt / aminudinMA.js
Created January 2, 2022 22:20
Aminudin MA
const arr = ['Saya', 'ingin', 'belajar', 'bersama']
arr.forEach((element, index) => {
console.log(`Item : ${element} Index ke ${index}`)
})
@tfkhdyt
tfkhdyt / segitigaSelisih432.js
Created December 18, 2021 11:03
Segitiga selisih 4..3..2..
for (let baris = 1; baris <= 5; baris++) {
let selisih = 4;
for (let kolom = 1, x = baris; kolom <= 5; kolom++) {
if (kolom <= baris) {
process.stdout.write(x + " ");
x += selisih;
selisih--;
}
}
console.log();
@tfkhdyt
tfkhdyt / urutanAngka.js
Created November 18, 2021 11:08
Urutan angka selisih 4 dan 1
let j = 10;
for (let i = 0; i < 9; i++) {
process.stdout.write(j + ' ');
if (i % 2 == 0) j += 4;
else j++;
}
@tfkhdyt
tfkhdyt / nilaiRataRata.py
Last active September 13, 2021 03:47
Program Menghitung Nilai Rata-rata dengan Python
# CREATED BY TAUFIK HIDAYAT
# BANDUNG, 13 SEPTEMBER 2021
from tabulate import tabulate # import module untuk membuat tabel
data = [] # inisialisasi list data
jmlMhs = int(input('Masukkan jumlah mahasiswa: ')) # input jumlah mahasiswa
for i in range(jmlMhs):
nama = input('\nMasukkan nama: ') # input nama