Skip to content

Instantly share code, notes, and snippets.

View trentwiles's full-sized avatar
🏁
riverside.rocks

Trent Wiles trentwiles

🏁
riverside.rocks
View GitHub Profile
@advaith1
advaith1 / top bots.md
Last active June 16, 2024 21:57
The top Discord bots ranked by server count
Rank Bot Approximate Server Count Library
1 MEE6 21,600,000 Custom Python
2 Rythm 🪦 15,200,000 JDA
3 Groovy 🪦 10,400,000 JDA, Discord4J
4 carl-bot 🅱️ 9,770,000 Pycord
5 ProBot
@youngchief-btw
youngchief-btw / getUrlVars.js
Last active July 8, 2020 19:11
Get URL Parameters in JS
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(
m,
key,
value
) {
vars[key] = value;
});
return vars;
@youngchief-btw
youngchief-btw / HTTP --> HTTPS.js
Last active December 8, 2021 00:13
HTTP --> HTTPS enforcement in Javascript
// HTTP --> HTTPS
if (location.protocol === "http:") {
location.replace(window.location.href.replace("http:", "https:"));
}
@Utopiah
Utopiah / glitch_backup.js
Created March 25, 2019 20:31
Download all your Glitch projects
// cf https://support.glitch.com/t/exporting-all-projects/9367/2
const fetch = require('node-fetch');
const wget = require('node-wget');
// cf localStorage.cachedUser in Glitch editor
var OWNER_TOKEN = "xxxx-yyyy-zzzzz-aaaa-bbbbb"
var USER_ID = "123456"
var PROJECT_ID = ""
var urlAllProjects = `https://api.glitch.com/users/${USER_ID}?authorization=${OWNER_TOKEN}`
@Mo45
Mo45 / discord.msg.send.php
Last active May 5, 2024 17:25
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
@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
def handle_call({:publish, message}, _from, %{sessions: sessions}=state) do
Enum.each(sessions, &send(&1.pid, message))
{:reply, :ok, state}
end
@ugraphix
ugraphix / temp.php
Last active April 8, 2024 08:03
Temperature conversions (Fahrenheit, Celsius, Kelvin) using PHP
<?php
//temp.php
//Celsius to Fahrenheit ° F = 9/5 ( ° C) + 32
//Fahrenheit to Celsius ° C = 5/9 (° F - 32)
//Celsius to Kelvin K = ° C + 273.15
//Kelvin to Celsius ° C = K - 273.15
//Fahrenheit to Kelvin K = 5/9 (° F - 32) + 273.15
//Kelvin to Fahrenheit ° F = 9/5 (K - 273.15) + 32
@nonsintetic
nonsintetic / readme.md
Last active January 19, 2024 10:57
PHP - Get YouTube subscriber count with Youtube API v3

How to:

Here's a 'simple' way to get the YouTube subscriber number from Google's Youtube API v3:

  1. Go to https://console.developers.google.com/apis/library
  2. Log in with your Google account.
  3. Next to the logo click on 'Project' and 'Create project'. Name it whatever you want and click on 'Create'.
  4. Wait until the project is created, the page will switch to it by itself, it will take a couple of seconds up to a minute. Once it's done it will be selected next to the logo.
  5. Once it's created and selected, click on 'Credentials' from the menu on the left.
  6. Click on 'Create Credentials' and choose 'API Key'. You can restrict it to specific IPs, or types of requests (website, android, ios etc.) if you want, it's safer that way.