Skip to content

Instantly share code, notes, and snippets.

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
@khandar-william
khandar-william / kaskus-chat-shortcut.js
Last active February 15, 2018 15:47
Kaskus Chat Web Keyboard Shortcuts
/*
Tested on Chrome only
1. Install Custom JavaScript for websites
https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija?utm_source=chrome-app-launcher-info-dialog
2. Open https://chat.kaskus.co.id
3. Click on "cjs" icon
4. Paste the code in this file
5. Click save
6. Enjoy your shortcuts!