Skip to content

Instantly share code, notes, and snippets.

View khandar-william's full-sized avatar

Khandar William khandar-william

View GitHub Profile
@khandar-william
khandar-william / 0-prompt.txt
Last active June 10, 2025 09:42
Sample Generated Technical Documentation
Write a Markdown file for technical documentation of "any-zkvm" library.
The goal of this document is to teach future engineers to understand and maintain this library correctly.
This document should also include {@docs: C4 Model} diagrams in {@docs: Mermaid} syntax at three different levels:
1. System context diagram
2. Container diagram
3. Component diagram

To find out where disk space is being used:

  1. use apt install ncdu

or

  1. Get to the root of your machine by running cd /
  2. Run sudo du -h --max-depth=1 | sort -rh
  3. Note which directories are using a lot of disk space.
  4. cd into one of the big directories.
// Tokopedia
function removeAdsType1() {
var adsType1 = document.querySelectorAll('a[label-atm="taProduct"]');
adsType1.forEach(function (e) {
e.parentNode.remove(e);
});
}
window.setInterval(removeAdsType1, 10000);
function removeAdsType2() {
// RestTemplate interceptor
public class CustomRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(
final HttpRequest request,
final byte[] body,
final ClientHttpRequestExecution execution
) throws IOException {
log.info("INTERCEPT {} {} {} body {}", request.getMethodValue(), request.getURI(), request.getHeaders(),

Expected state mixing local transaction and external API

\ DB succeed DB failed
API succeed DB changed, API changed DB unchanged, API unchanged
API failed DB unchanged, API unchanged DB unchanged, API unchanged
// Put in build.gradle
// Log timings per task.
class TimingsListener implements TaskExecutionListener, BuildListener {
private Clock clock
private timings = []
@Override
void beforeExecute(Task task) {
clock = new org.gradle.util.Clock()

Brown Bag Ethereum Notes

Prerequisite:

  1. Install ethereum dan solc
    sudo apt-get install software-properties-common
    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo apt-get update
    

sudo apt-get install ethereum solc

var EVENTS = [
// source: https://www.w3.org/TR/html5/semantics-embedded-content.html#media-elements-event-summary
'loadstart', 'progress', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'play', 'pause', 'ratechange', 'resize', 'volumechange',
// source: https://github.com/videojs/video.js/search?q=fires&unscoped_q=fires
'beforemodalopen', 'modalopen', 'beforemodalclose', 'addtrack', 'modechange', 'change', 'selectedchange', 'enabledchange', 'close', 'beforepluginsetup', 'pluginsetup', 'dispose', 'removetrack', 'sourceset', 'load', 'slideractive', 'sliderinactive', 'statechanged', 'playerresize', 'ready',
// source: https://support.brightcove.com/advertising-ima3-plugin
'adstart', 'adend', 'readyforpreroll', 'ima3-ready', 'ima3error', 'ima3-ad-error', 'ads-request', 'ads-load', 'ads-ad-started', 'ads-ad-ended', 'ads-pause', 'ads-play', 'ads-ad-skippe
@khandar-william
khandar-william / github_load_all_diffs.js
Created March 26, 2018 07:36 — forked from juanca/github_load_all_diffs.js
Github PR bookmarklet: Load all file diffs
javascript:document.querySelectorAll('.load-diff-button').forEach(node => node.click())
// git: To delete all local branches that are already merged into the currently checked out branch:
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
// git: Delete local git branch
git branch -D <branch_name>
// git: Delete remote git branch
git push <remote_name/origin> --delete <branch_name>
// git: Pick specific file from another branch