Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
View GitHub Profile
@korrio
korrio / datatables.js
Created October 17, 2023 07:53
datatables.js
'use strict';
var DatatableBasic = (function() {
// Variables
var $dtBasic = $('#datatable-basic');
var $dtBasic2 = $('#datatable-basic2');
let searchParams = new URLSearchParams(window.location.search)
@korrio
korrio / dashboardSlice.tsx
Last active October 4, 2023 03:32
dashboardSlice.tsx
import { createAsyncThunk, createSlice, Draft } from '@reduxjs/toolkit';
import { AppThunk, RootState } from '@/store/index';
import Http from '@/api/Http';
type DashboardState = {
title: string;
btc_pending: string;
btc_pending_usd: string;
capital: number;
your_income: string;
@korrio
korrio / dashboard.json
Created September 29, 2023 10:44
dashboard.json
{
"title": "Dashboard",
"balance": "0",
"referral_count": 0,
"contracts": [
{
"id": 138,
"user_id": 51,
"plan_id": 1,
"amount": 10,
@korrio
korrio / falsehoods-programming-time-list.md
Created September 17, 2023 23:06 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@korrio
korrio / useInterval.ts
Created May 16, 2023 01:41
useInterval.ts
import { useEffect, useRef } from 'react'
export const useInterval = (
callback: () => Promise<void>,
delay: number | null | false
) => {
const savedCallback = useRef<() => Promise<void>>()
useEffect(() => {
savedCallback.current = callback
@korrio
korrio / EscrowBNB.sol
Created April 29, 2023 08:18
EscrowBNB.sol
/**
*Submitted for verification at BscScan.com on 2022-11-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
@korrio
korrio / login.js
Created April 11, 2023 03:21
login.js
import { useState,useEffect } from "react";
import { useRouter } from 'next/router';
import clsx from "clsx";
import { useWeb3Context } from '../../context'
import WalletConnectorDialog from "./WalletConnectorDialog";
import WalletConnectorDialogNew from "./WalletConnectorDialogNew";
import httpRequest from '@/common/utils/httpRequest';
import showToast from '@/common/utils/showToast';
@korrio
korrio / gpg.js
Last active March 24, 2023 07:34
GPG Encryption
const fs = require('fs');
const openpgp = require('openpgp');
// Generate a new key pair (public key and private key)
const { privateKeyArmored, publicKeyArmored } = await openpgp.generateKey({
type: 'rsa',
userIDs: [{ name: 'John Doe', email: '[email protected]' }],
passphrase: 'mySecretPassphrase',
});
@korrio
korrio / encrypt_decrypt.js
Last active March 24, 2023 07:02
Encrypt / decrypt CSV file in Diffie-Hellman algorithm ?
// Import required libraries
const crypto = require('crypto');
const fs = require('fs');
// Generate a random large prime number (p) and a primitive root (g)
const p = crypto.createDiffieHellman(256).getPrime();
const g = 2;
// Alice's secret key (a), alice is PTG as a data supplier
const a = crypto.randomBytes(32);
@korrio
korrio / rr.php
Created March 8, 2023 07:09
rr.php
<?php
// Define the list of IPs
$processes = ['IP1', 'IP2', 'IP3', 'IP4', 'IP5'];
// Define the time slice for each IP
$timeSlice = 2;
// Define the current process index
$currentProcessIndex = 0;