Skip to content

Instantly share code, notes, and snippets.

@yogasw
yogasw / ZigZagSequence.go
Created September 5, 2022 23:46
ZigZagSequence.go
package main
import (
"bufio"
"fmt"
"io"
"os"
"sort"
"strconv"
"strings"
let number1 = 91532
let number2 = 1174885093020
let number3 = 373520
let number4 = 53772457827.00
let number5 = 212999166433.00
function printCurrency(number) {
// Nine Zeroes for Trillion
let value = Math.abs(Number(number)) >= 1.0e+12
function printCurrency(number) {
// Nine Zeroes for Trillion
let value = Math.abs(Number(number)) >= 1.0e+12
? (Math.abs(Number(number)) / 1.0e+12).toFixed(1) + " Triliun"
: Math.abs(Number(number)) >= 1.0e+9
? (Math.abs(Number(number)) / 1.0e+9).toFixed(1) + " Miliar"
// Six Zeroes for Millions
: Math.abs(Number(number)) >= 1.0e+6
// This injects a box into the page that moves with the mouse;
// Useful for debugging
async function installMouseHelper(page) {
await page.evaluateOnNewDocument(() => {
// Install mouse helper only for top-level frame.
if (window !== window.parent)
return;
window.addEventListener('DOMContentLoaded', () => {
const box = document.createElement('puppeteer-mouse-pointer');
const styleElement = document.createElement('style');
@yogasw
yogasw / endorse.user.js
Last active April 27, 2021 14:49
Endorse 5CC Erepublik
// ==UserScript==
// @name Endorse 5CC
// @namespace https://github.com/arioki1
// @version 0.1
// @description try to take over the world!
// @author Arioki
// @match https://www.erepublik.com/*/article/*
// @icon https://www.google.com/s2/favicons?domain=erepublik.com
// @grant none
// ==/UserScript==
@yogasw
yogasw / 1. Building PHP-MAMP on Apple Silicon M1.md
Created March 23, 2021 23:36 — forked from lennardv2/1. Building PHP-MAMP on Apple Silicon M1.md
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
Rosetta2 191.654 sec 1.96 MOp/s
Intel i7-4790K (imac 2014) 156.791 sec 2.39 MOp/s
Intel i5-8500B (mini 2018) 141.381 sec 2.65 MOp/s
ARM m1 43.745 sec 8.58 MOp/s
@yogasw
yogasw / execution-time.js
Created March 11, 2021 02:32 — forked from VanDalkvist/execution-time.js
How to Measure Execution Time in Node.js
var start = new Date();
var hrstart = process.hrtime();
setTimeout(function (argument) {
// execution time simulated with setTimeout function
var end = new Date() - start,
hrend = process.hrtime(hrstart);
console.info("Execution time: %dms", end);
console.info("Execution time (hr): %ds %dms", hrend[0], hrend[1]/1000000);
var syncDep;
function getLottery() {
return new Promise((resolve, reject) =>{
if (syncDep === undefined) { //check of we already have this data...if not THEN go get
setTimeout(function() {
syncDep = [1,22,34,56,5];
resolve(syncDep);
}, 2000);
} else {
@yogasw
yogasw / OLXCrawler.md
Last active June 7, 2020 06:34
Crawl OLX Automatis : Patal Perfoms 06/2020

OLX Crawler (tools untuk crawl olx automatis)

by Yoga Setiawan

OLX Crawler?

OLX Crawler adalah bot yang berfungsi untuk memonitoring situs olx secara automatis dan mengirim data yang di hasilnya secara detail ke whatsapp

Situs yand di suport