Skip to main content
Loading...

More JavaScript Posts

import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'


const { exec } = require("child_process");

exec("sensors|grep "high"|grep "Core"|cut -d "+" -f2|cut -d "." -f1|sort -nr|sed -n 1p", (error, stdout, stderr) => {
    if (error) {
        console.log(`error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }
    console.log(`stdout: ${stdout}`);
});

export default function Home() {
  return (
    <div className={styles.container}>
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>

      <main className={styles.main}>
        <h1 className={styles.title}>
          Welcome to <a href="https://nextjs.org">Next.js!</a>
        </h1>

        <p className={styles.description}>
          Get started by editing{' '}
          <code className={styles.code}>pages/index.js</code>
        </p>

        <div className={styles.grid}>
          <a href="https://nextjs.org/docs" className={styles.card}>
            <h2>Documentation &rarr;</h2>
            <p>Find in-depth information about Next.js features and API.</p>
          </a>

          <a href="https://nextjs.org/learn" className={styles.card}>
            <h2>Learn &rarr;</h2>
            <p>Learn about Next.js in an interactive course with quizzes!</p>
          </a>

          <a
            href="https://github.com/vercel/next.js/tree/canary/examples"
            className={styles.card}
          >
            <h2>Examples &rarr;</h2>
            <p>Discover and deploy boilerplate example Next.js projects.</p>
          </a>

          <a
            href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
            className={styles.card}
          >
            <h2>Deploy &rarr;</h2>
            <p>
              Instantly deploy your Next.js site to a public URL with Vercel.
            </p>
          </a>
        </div>
      </main>

      <footer className={styles.footer}>
        <a
          href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
          target="_blank"
          rel="noopener noreferrer"
        >
          Powered by{' '}
          <span className={styles.logo}>
            <Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
          </span>
        </a>
      </footer>
    </div>
  )
}
//Use at https://mee6.xyz/leaderboard/732262089447702588
//Higher the spammy stat, the more spammy that person is.
//This is because mee doesn't give experience to people who post more comments in a minute.
function statBlock(title, value){
	let elm = document.createElement("div");
	elm.className = "leaderboardPlayerStatBlock";
	let titleElm = document.createElement("div");
	titleElm.className = "leaderboardPlayerStatName";
	titleElm.textContent = title;
	let valueElm = document.createElement("div");
	valueElm.className = "leaderboardPlayerStatValue";
	valueElm.textContent = value;
	elm.appendChild(titleElm);
	elm.appendChild(valueElm);
	elm.remove = function(){
	this.parentElement.removeChild(this);
	}
	return elm;
}
for(let player of Array.from(document.getElementsByClassName("leaderboardPlayer"))){
	if(player.spamminess) player.spamminess.remove();
	let messages = null;
	let experience = null;
	const statBlockArray = Array.from(player.querySelectorAll(".leaderboardPlayerStatBlock"));
	for(let statBlock of statBlockArray){
	const statName = statBlock.querySelector(".leaderboardPlayerStatName").textContent;
	const text = statBlock.querySelector(".leaderboardPlayerStatValue").textContent;
	const number = ((text.includes("k"))? (text.replace("k","") * 1000.0) : +(text));
	if(statName.includes("MESSAGES")){
	messages = number;
	}else if(statName.includes("EXPERIENCE")){
	experience = number;
	}
	}
	const stats = player.querySelector(".leaderboardPlayerStats");
	const messagesElement = stats.firstChild;

	const spamminess = ((messages/experience)*2000.0).toFixed(2);
	
	player.spamminess = stats.insertBefore(statBlock("SPAMMINESS", spamminess), messagesElement);
}
var arr = [{
    "success": true,
    "data": [
        {
            "id": "ipi_1KrrbvDOiB2klwsKhuqUWqt1",
            "object": "issuing.transaction",
            "amount": -2743,
            "amount_details": {
                "atm_fee": null
            },
            "authorization": "iauth_1KrrbuDOiB2klwsKoFjQZhhd",
            "balance_transaction": "txn_1KrrbwDOiB2klwsK1YkjJJRi",
            "card": "ic_1Krqe5DOiB2klwsK44a35eiE",
            "cardholder": "ich_1KrqL8DOiB2klwsKtBnZhzYr",
            "created": 1650753567,
            "currency": "usd",
            "dispute": null,
            "livemode": false,
            "merchant_amount": -2743,
            "merchant_currency": "usd",
            "merchant_data": {
                "category": "advertising_services",
                "category_code": "7311",
                "city": "San Francisco",
                "country": "US",
                "name": "Aeros Marketing, LLC",
                "network_id": "1234567890",
                "postal_code": "94103",
                "state": "CA"
            },
            "metadata": {},
            "type": "capture",
            "wallet": null
        },
                {
            "id": "ipi_1Krrbvc62B2klwsKhuqUWqt1",
            "object": "issuing.transaction",
            "amount": -9999,
            "amount_details": {
                "atm_fee": null
            },
            "authorization": "iauth_1KrrbuDOiB2klwsKoFjQZhhd",
            "balance_transaction": "txn_1KrrbwDOiB2klwsK1YkjJJRi",
            "card": "ic_1Krqe5DOiB2klwsK44a35eiE",
            "cardholder": "ich_1KrqL8DOiB2klwsKtBnZhzYr",
            "created": 1650753567,
            "currency": "USD",
            "dispute": null,
            "livemode": false,
            "merchant_amount": -9999,
            "merchant_currency": "usd",
            "merchant_data": {
                "category": "fast_food",
                "category_code": "7311",
                "city": "San Francisco",
                "country": "US",
                "name": "Aeros Marketing, LLC",
                "network_id": "1234567890",
                "postal_code": "94103",
                "state": "CA"
            },
            "metadata": {},
            "type": "capture",
            "wallet": null
        }
    ]
}];
    

const reduced = arr.reduce((prev, curr) => {
    prev.push({
        amount: curr.data[0].merchant_amount,
        id: curr.data[0].id,
        currency: curr.data[0].currency,
        category: curr.data[0].merchant_data.category
    });
    console.log(prev)

    return prev;
    
}, []);