Skip to content

Instantly share code, notes, and snippets.

View supernovaplus's full-sized avatar

SuperNova+ supernovaplus

View GitHub Profile
@supernovaplus
supernovaplus / force-ctrl-c-v.md
Created May 13, 2023 16:27 — forked from Gustavo-Kuze/force-ctrl-c-v.md
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 
@supernovaplus
supernovaplus / date.diff.js
Last active June 27, 2022 21:05
date diff
function getTimeDiffFromNow(timestamp) {
const diff = timestamp - Date.now();
const absDiff = Math.abs(diff);
const dateObj = {
year: Math.floor(absDiff / 31_104_000_000),
month: Math.floor((absDiff / 2_592_000_000) % 12),
day: Math.floor((absDiff / 86_400_000) % 30),
hour: Math.floor((absDiff / 3_600_000) % 24),
minute: Math.floor((absDiff / 60_000) % 60),
second: Math.floor((absDiff / 1_000) % 60),
@supernovaplus
supernovaplus / sierpinski.html
Last active June 23, 2022 13:46
Sierpiński triangle made in html5 canvas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
* {
@supernovaplus
supernovaplus / discord.msg.send.php
Created May 31, 2022 21:20 — forked from Mo45/discord.msg.send.php
PHP - Send message to Discord via Webhook
<?php
//=======================================================================================================
// Create new webhook in your Discord channel settings and copy&paste URL
//=======================================================================================================
$webhookurl = "YOUR_WEBHOOK_URL";
//=======================================================================================================
// Compose message. You can use Markdown
// Message Formatting -- https://discordapp.com/developers/docs/reference#message-formatting
;(async () => {
const stringToFind = 'hello WORLD';
let result = '';
for (let i = 0; i < stringToFind.length; i++) {
for (let j = 32; j < 127; j++) {
await new Promise(resolve => setTimeout(resolve, 10));
console.log(result + String.fromCharCode(j));
if(stringToFind.charCodeAt(i) === j){
result += stringToFind.charAt(i);
break;
@supernovaplus
supernovaplus / discord.api.bot.post.files.js
Created November 2, 2021 16:56
discord api bot post files js node
const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");
const wait = (ms = 1000) => new Promise(resolve => setTimeout(resolve, ms));
const channelId = "---";
const botToken = "---";
const filesInDownloads = fs.readdirSync("./downloaded");
console.log(`Files: ${filesInDownloads.length}`);
const axios = require("axios");
const FormData = require("form-data");
const webhook = "https://discord.com/api/webhooks/....";
//post message to discord channel via webhook
module.exports = post_discord_log = async(message = "") => {
if(!message || typeof message !== "string"){
return Promise.resolve(false);
}
require("dotenv").config();
const AWS = require('aws-sdk');
const s3config = new AWS.Config({
credentials: new AWS.Credentials({
accessKeyId: process.env.accessKeyId,
secretAccessKey: process.env.secretAccessKey
}),
region: 'nl-ams',
endpoint: new AWS.Endpoint('https://s3.nl-ams.scw.cloud')
// ==UserScript==
// @name TTMAP WAYPOINT
// @namespace TTMAP WAYPOINT
// @match https://ttmap.eu/*
// @version 1.0
// @author logan + nova
// @downloadURL https://gist.github.com/sadboilogan/83c0effe25741607ccfc73ca83335c59/raw/ttools.user.js
// @description Extends TTools site
// ==/UserScript==
@supernovaplus
supernovaplus / gist:3484e3e428486f4dd3da21af47558c5b
Created July 8, 2021 09:28 — forked from girvydas/gist:f2d727716a3e27773329
Lietuviškų vardų (ir pavardžių?) linksniai
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Dainius Kaupaitis <dainius at kaupaitis dot lt>
* @copyright Copyleft (ↄ) 2011, Dainius Kaupaitis
* @version 1.0
* @package Vardai
*/