Skip to content

Instantly share code, notes, and snippets.

View itslukej's full-sized avatar
🥑

Luke James itslukej

🥑
View GitHub Profile
@itslukej
itslukej / ads.js
Last active December 6, 2020 14:05
NitroPay Consent Framework x AdSense
function injectAdSense() {
const script = document.createElement('script');
script.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
script.async = true;
script.setAttribute('data-ad-client', 'ca-pub-XXXXXXXXXXXXXXXX');
document.head.appendChild(script);
}
<template>
<div>
<span v-for="n in 5" :key=n>
<fa
:icon="[rating >= n ? 'fas' : 'far', 'star']"
@mouseover="rating = n"
@mouseleave="rating = 0"
@click="$emit('rated', rating)"
/>
</span>
local shard_id = tonumber(ARGV[3])
local shard_count = tonumber(ARGV[2])
local prefix = 'cache:' .. ARGV[1] .. ':'
local keys = redis.call('keys', prefix .. '*')
local deleted = 0
for i,v in pairs(keys) do
local key = keys[i]
local guild_id = string.sub(key, #prefix + 1)
import { toBigIntBE, toBufferBE } from 'bigint-buffer';
export function encode(hash: string) {
const buffer = Buffer.from(hash, "hex");
return [toBigIntBE(buffer.slice(0, 8)), toBigIntBE(buffer.slice(8, 16))];
}
export function decode(first: bigint, second: bigint) {
const buffer1 = toBufferBE(first, 8);
use warp::Filter;
use dotenv::dotenv;
use std::env;
#[tokio::main]
async fn main() {
dotenv().ok();
let port = env::var("PORT")
.expect("Port not found")
@itslukej
itslukej / voice_servers.json
Created March 8, 2020 22:00
List of all of discord's voice servers as of 08-03-2020
[
{
"ip": "185.50.107.211",
"dns": "brazil0.discord.gg",
"city": "Cotia",
"region": "São Paulo",
"country": "BR",
"org": "AS49544 i3D.net B.V"
},
{
@itslukej
itslukej / protomap.ts
Last active March 30, 2020 22:40
Simple map-like interface for encoded storage w/ bigint keys
declare class ProtoMessage {
serializeBinary(): Uint8Array;
static deserializeBinary(bytes: Uint8Array): any;
}
export default class ProtoMap<K, V extends ProtoMessage> {
private map: Map<K, ReturnType<ProtoMessage["serializeBinary"]>> = new Map;
constructor(private message: typeof ProtoMessage) {}
@itslukej
itslukej / discord.proto
Last active June 10, 2023 11:35
Protobuf messages for Discord
syntax = "proto3";
package discord;
message Icon {
bytes hash = 1;
bool animated = 2;
}
message Guild {
string name = 2;
@itslukej
itslukej / index.js
Created February 4, 2020 15:49
Protobuf test
const protobuf = require('protobufjs');
const sizeof = require('object-sizeof');
protobuf.load("invite.proto", (err, root) => {
const Invite = root.lookupType("prototest.Invite");
const payload = {
code: 'vexera',
guild_id: 228838562500575233n,
guild_name: 'Vexera Official',
@itslukej
itslukej / ksoft_scrape.js
Last active January 22, 2020 14:35
Proof of Concept to scrape lyrics from KSoft.Si's upcoming lyrics pages
const puppeteer = require('puppeteer');
async function getLyrics(url) {
const browser = await puppeteer.launch({ headless: false });
const [page] = await browser.pages();
await page.setRequestInterception(true);
page.on('request', request => {
if (request.resourceType() === 'script')