Skip to content

Instantly share code, notes, and snippets.

View faytranevozter's full-sized avatar
👟
RUN

Fahrur Rifai faytranevozter

👟
RUN
View GitHub Profile
#!/bin/bash
# Define usage function
usage() {
echo "Usage: $0 {backup|restore} -v <volume_name> -f <file_path>"
echo "Options:"
echo " backup: Back up the specified Docker volume to a tarball."
echo " restore: Restore a Docker volume from a tarball."
echo " -v <volume_name>: Name of the Docker volume."
echo " -f <file_path>: Path to the tarball file."
@faytranevozter
faytranevozter / sphp.sh
Last active December 3, 2025 13:28
sphp
#!/bin/bash
# PHP Version Switcher for shivammathur/homebrew-php
# Author: Fahrur Rifai
# Usage: ./sphp.sh <version> [variant]
# Example: ./sphp.sh 8.2
# Example: ./sphp.sh 8.2 zts
# Example: ./sphp.sh 8.2 debug
set -e
@faytranevozter
faytranevozter / build_docker.sh
Last active December 30, 2025 06:31
Build docker from repository
#!/bin/bash
set -euo pipefail
# Include color configuration (optional)
source ~/.fay/colors 2>/dev/null || true
function _docker_snippet_help() {
printf "${BBlue}╔══════════════════════════════════════════════════════════╗${Color_Off}\n"
printf "${BBlue}║ ${BYellow}Docker Build & Push Helper v1.1${BBlue} ║${Color_Off}\n"
@faytranevozter
faytranevozter / tes.txt
Last active July 17, 2023 09:29
something
ngrok config add-authtoken 2Sh58U4OUteeyVMXUpnGviJpws3_5NWWiG6Z4r5bmVdTWCRAL
@faytranevozter
faytranevozter / query.sql
Last active October 19, 2022 14:52
sub query tabel yang sama
-- create schema
CREATE TABLE users (
id int not null primary key auto_increment,
name varchar(50) not null,
parent_id int null default null
);
-- insert data
INSERT INTO users (id, name, parent_id) VALUES
(1, 'Zaki', 2),
@faytranevozter
faytranevozter / anagram.js
Created October 19, 2022 14:49
mengelompokkan sebuah array of strings menjadi kumpulan anagram. ps: hanya berlaku untuk jumlah huruf yang sama
const solve = (words) => {
const result = {}
for (word of words) {
const key = word.split('').sort().join('')
if (typeof result[key] === 'undefined'){
result[key] = []
}
result[key].push(word)
}
return Object.values(result)
@faytranevozter
faytranevozter / postman-jsonpath.html
Last active February 25, 2021 12:21
JSON searchable postman response test script
<input type="text" id="filter" value="$"><pre id="display"></pre><style>#filter{padding:10px;width:400px;font-family:monospace}#display{background-color:#ccc;border-radius:1rem;padding:10px;min-height:50px}.error{background-color:#ffcdd2 !important;color:#6f0404 !important}</style> <script src="https://unpkg.com/jsonpath@1.0.2/./jsonpath.js"></script> <script>pm.getData((err,val)=>{const json=val.response;const findJSON=()=>{try{const filtered=jsonpath.query(json,document.querySelector('#filter').value);document.querySelector('#display').classList.remove('error');document.querySelector('#display').innerHTML=JSON.stringify(filtered,null," ");}catch(err){document.querySelector('#display').classList.add('error');document.querySelector('#display').innerHTML=err.message;}};document.querySelector('#filter').addEventListener('keyup',findJSON);findJSON();})</script>
@faytranevozter
faytranevozter / Eslint config
Created November 9, 2019 08:17
.eslintrc.js
module.exports = {
env: {
es6: true,
node: true,
},
extends: [
'airbnb-base'
],
plugins: [
],
@faytranevozter
faytranevozter / SimpleHeap.java
Last active January 6, 2018 06:43
Ini YA :)
import java.util.Scanner;
class SimpleHeap {
public static Scanner scanner = new Scanner(System.in);
public static String menu = "0";
public static int N = 5;
public static BaseData awal;
public static BaseData akhir;
public static void inisialisasiSenaraiKosong() {
BaseData data1 = new BaseData();
import java.util.Scanner;
class simpul {
// bagian deklarasi struktur record ----------------------------------
String nama;
String alamat;
int umur;
char jekel;
String hobi[] = new String[3];
float ipk;
simpul kiri;