This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ini_set('display_errors', 1); | |
// ini_set('display_startup_errors', 1); | |
// error_reporting(E_ALL); | |
//from https://stackoverflow.com/questions/65133851/uploading-file-to-discord-with-webhook-in-php | |
//file is being called by a POST request in my case | |
//print_r for debugging | |
//default max size discord accepts is 8MB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//from https://stackoverflow.com/questions/65133851/uploading-file-to-discord-with-webhook-in-php | |
//file is being called by a POST request in my case | |
//print_r for debugging | |
//default max size discord accepts is 8MB | |
echo "<pre>"; | |
$webhookurl = "https://discord.com/api/webhooks/xxxx/xxxxxxx"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const discord_permissions = [["CREATE_INSTANT_INVITE",1],["KICK_MEMBERS *",2],["BAN_MEMBERS *",4],["ADMINISTRATOR *",8],["MANAGE_CHANNELS *",16],["MANAGE_GUILD *",32],["ADD_REACTIONS",64],["VIEW_AUDIT_LOG",128],["PRIORITY_SPEAKER",256],["STREAM",512],["VIEW_CHANNEL",1024],["SEND_MESSAGES",2048],["SEND_TTS_MESSAGES",4096],["MANAGE_MESSAGES *",8192],["EMBED_LINKS",16384],["ATTACH_FILES",32768],["READ_MESSAGE_HISTORY",65536],["MENTION_EVERYONE",131072],["USE_EXTERNAL_EMOJIS",262144],["VIEW_GUILD_INSIGHTS",524288],["CONNECT",1048576],["SPEAK",2097152],["MUTE_MEMBERS",4194304],["DEAFEN_MEMBERS",8388608],["MOVE_MEMBERS",16777216],["USE_VAD",33554432],["CHANGE_NICKNAME",67108864],["MANAGE_NICKNAMES",134217728],["MANAGE_ROLES *",268435456],["MANAGE_WEBHOOKS *",536870912],["MANAGE_EMOJIS *",1073741824]]; | |
discord_permissions.forEach(perm=>{ | |
console.log(perm[0], (discord_user_guild_permissions & perm[1]) === perm[1]) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hexToDouble1(num){//expensive | |
const splittedNum = num.match(/../g); | |
const buf = new ArrayBuffer(8); | |
const view = new DataView(buf); | |
splittedNum.forEach(function (val, index) { | |
view.setInt8(index, parseInt(val, 16)); | |
}); | |
return view.getFloat64(0, 0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.*; | |
public class Main { | |
static void printBonusDatesBetween(int fromYear, int toYear) { | |
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); | |
Calendar cal = Calendar.getInstance(); | |
cal.set(fromYear, 0, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data.duration.split(".")[0].split(":").reduce((acc,val,i)=>i===0 ? acc += +val * 60 * 60 : i===1 ? acc += +val * 60 : acc += +val,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//case(3): array_push($fetch_array, [&$response->vouchers,"select * from vouchers_config;"]); break; | |
function fetchdb($data){ | |
global $response, $conn; | |
$query = ""; | |
for ($i=0; $i < count($data); $i++) { | |
$query .= $data[$i][1]; | |
} | |
if (mysqli_multi_query($conn, $query)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const fetch = require("node-fetch") | |
const path = "C:\\DOWNLOADS\\"; | |
const urlArray = [ | |
//["url","fileName"] | |
//"url" | |
//["url","filename"],"url",["url","filename"] | |
"http://somesite.com/somevideo.mp4", | |
["http://somesite.com/somevideo2.mp4","renamedvideo.mp4"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = `149579 | |
95962 | |
97899 | |
etc...`; | |
input = input.split("\n").map(n=>Number(n)); | |
const part1 = (number) => { | |
let val = (Math.floor(number/3)-2) | |
return val > 0 ? val : 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function COPYVOUCHERSONDATE() { | |
//if(new Date().getDay()!=6)return Logger.log("not today ;)"); | |
var DATETIMESTRING = Utilities.formatDate(new Date(),"GMT+1","M/d"); | |
var spreadsheet = SpreadsheetApp.openById("-"); | |
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Vouchers'), true); | |
spreadsheet.duplicateActiveSheet(); | |
spreadsheet.moveActiveSheet(17); |