Skip to content

Instantly share code, notes, and snippets.

View w33ladalah's full-sized avatar
🌎
Working from anywhere

Hendro Wibowo w33ladalah

🌎
Working from anywhere
View GitHub Profile
#include <stdio.h>
#include <iostream>
struct WAKTU {
int jam;
int menit;
int detik;
};
struct BARANG {
Get disk usage with sorting: du -s * | sort -rn | cut -f2- | xargs -d "\n" du -sh
@w33ladalah
w33ladalah / basic_algorithm.c
Created April 12, 2024 01:34
Program sederhana yang merupakan implementasi dari bubble sort, selection sort, sequential search, dan binary search.
#include <stdio.h>
// Buat structure untuk mahasiswa
struct Mahasiswa {
char const *nim; // NIM dengan tipe char
char const *nama; // Nama dengan tipe char
int nilai; // Nilai dengan tipe integer
};
// Bubble sort
@w33ladalah
w33ladalah / shell-short.c
Last active March 31, 2024 13:24
Shell Short di C
// Shell Sort in C programming
#include <stdio.h>
// Shell sort
void shellSort(int array[], int n) {
// Urutkan angka-angka dengan interval n/2, kemudian n/4 atau (n/2)/2, n/8, dan seterusnya
for (int interval = n / 2; interval > 0; interval /= 2) {
printf("%d \n", interval);
for (int i = interval; i < n; i += 1) {
// My answer for Exercism's Clock exercise
use std::fmt;
#[derive(PartialEq)]
pub struct Clock {
hours: i32,
minutes: i32,
}
impl Clock {
@w33ladalah
w33ladalah / puppeteer-wrapper-class.js
Created February 8, 2022 22:23
Puppeteer Wrapper Class in ES6
import fs from 'fs';
import JSONdb from 'simple-json-db';
import puppeteer from 'puppeteer-core';
/**
* chromePath: the path of the chrome executable in our pc
* setup() : initialize Puppeteer
* cleanup(): clearnup Puppeteer
* browser: global Puppeteer browser instance
* newPage(): get new page with default user agent and dimensions
@w33ladalah
w33ladalah / screenshot.sh
Created July 27, 2017 09:54
Take screenshots every n seconds automatically. Works on Linux.
while true; do scrot -d $1 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f $2'; done;
@w33ladalah
w33ladalah / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console