Skip to content

Instantly share code, notes, and snippets.

View Arsfiqball's full-sized avatar
:octocat:
Focusing

Iqbal Mohammad Abdul Ghoni Arsfiqball

:octocat:
Focusing
View GitHub Profile
@Arsfiqball
Arsfiqball / github_history_say.py
Created January 15, 2024 00:45
Say something in your github history by adding commits into your repository
import os
from datetime import datetime, timedelta
def transpose_2d_array(array):
return list(map(list, zip(*array)))
def run_x_times(x, command):
for i in range(x):
os.system(command)
@Arsfiqball
Arsfiqball / readme.md
Created June 24, 2022 15:26
My ZSH Config

So it's been almost 5 years I use this ZSH theme, and I never share it. So just to let you know. You may try and maybe like it.

Prerequisite

Config

Open ~/.zshrc and set ZSH_THEME="spaceship". Then add these code anywhere above plugins=(git):

@Arsfiqball
Arsfiqball / regresi_kuadratik.cpp
Last active May 23, 2020 04:19
Contoh regresi linier dan regresi kuadratik pada C++
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
// ==================
// CONTOH DATA (X, Y)
// ==================
const int n = 6;
@Arsfiqball
Arsfiqball / run-script.html
Last active July 26, 2021 18:47
Run javascript from a html textarea
<!DOCTYPE html>
<html>
<head>
<title>Run Script</title>
</head>
<body>
<textarea id="code">return 1 + 4</textarea>
<button onclick="run()">Run</button>
<pre id="result"></pre>
<script>
@Arsfiqball
Arsfiqball / index.js
Created August 2, 2019 00:51
Wrap async function to express compatible middleware
// wrapper function
function wrap (fn) {
return function (req, res, next) {
return fn(req, res, next).catch(err => {
// handle general error here
next(err)
})
}
}
@Arsfiqball
Arsfiqball / index.js
Created July 27, 2019 03:58
Validate unique value of database using knex.js and validate.js
const assert = require('assert')
const validate = require('validate.js')
const db = require('./db') // instance of knex
// custom validation
validate.validators.unique = function (value, options, key) {
assert.ok(!!options.table)
assert.ok(!!options.column)
assert.ok(!!options.db)
@Arsfiqball
Arsfiqball / Contoh1.java
Created December 12, 2018 12:01
Object Oriented Programming tentang "Komunikasi antar objek" dimana ada 4 metode dasar, diantaranya 1) Direct, 2) Injection, 3) Interface, 4) Adapter
package app;
class Charger {
public int getElectricity() {
return 10;
}
}
class Handphone {
private Charger charger = new Charger();
@Arsfiqball
Arsfiqball / tugas-tebak-angka-gui.py
Last active November 1, 2023 15:32
Tugas membuat game tebak angka menggunakan bahasa Python dengan GUI dari Tkinter. Ini adalah implementasi dari Python 2. Untuk pengguna Python 3 ada sedikit perbedaan seperti library "Tkinter" menggunakan huruf kecil "tkinter" dan sisanya adalah sintaks umum dikotomi Python 2 & 3 seperti print. Penjelasannya ada di setiap segmen algoritma. Progr…
import random
from Tkinter import *
class App(Frame):
# Untuk membuat angka acak
# exclude adalah array dari angka yang harus dibuang misal ["1", "4", "7"]
# caranya dengan memanggil misal self.angka_acak(["1", "4", "7"])
@staticmethod
def angka_acak(exclude):
# angka yang tersedia
@Arsfiqball
Arsfiqball / afk_modulation.m
Created October 28, 2018 12:00
Amplitude and Frequency Shift Keying Modulation simulation using MatLab
%% Variables Definition
fps = 400;
data = [1 0 0 1 1 0 1 0 1 1];
A = 4;
f = 8;
f0 = 2;
%% Create the signal of "Information"
info_signal = gen_INFO(data, fps);
@Arsfiqball
Arsfiqball / pembagi.cpp
Last active December 1, 2016 15:21
Kode c++ untuk pembagian, tanpa menggunakan operator pembagian.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int b, p, h, b_negative, p_negative;
printf("Masukan bilangan yang akan dibagi: ");
scanf("%d", &b);
printf("Masukan bilangan yang pembagi: ");
scanf("%d", &p);