Compare commits
No commits in common. "074b0c88075de4867090989ddd6b995402aaa76f" and "02c36a50470956b31d6521590c7a92dc22b1f437" have entirely different histories.
074b0c8807
...
02c36a5047
|
@ -1,13 +1,5 @@
|
||||||
{
|
{
|
||||||
"recentFiles": [
|
"recentFiles": [
|
||||||
{
|
|
||||||
"basename": "C++",
|
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/Languages/C++.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"basename": "gdevelop.io",
|
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/gdevelop.io.md"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"basename": "Neopets",
|
"basename": "Neopets",
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md"
|
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md"
|
||||||
|
@ -17,8 +9,8 @@
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Ruffle.md"
|
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Ruffle.md"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"basename": "StackBlitz",
|
"basename": "gdevelop.io",
|
||||||
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Tools/StackBlitz.md"
|
"path": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/gdevelop.io.md"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"basename": "Webscraping",
|
"basename": "Webscraping",
|
||||||
|
@ -199,6 +191,14 @@
|
||||||
{
|
{
|
||||||
"basename": "Math terms & Probabilities",
|
"basename": "Math terms & Probabilities",
|
||||||
"path": "Machine Tips (Quantum)/Math/Math terms & Probabilities.md"
|
"path": "Machine Tips (Quantum)/Math/Math terms & Probabilities.md"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"basename": "Proof of a formula for modulo",
|
||||||
|
"path": "Machine Tips (Quantum)/Math/Proof of a formula for modulo.md"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"basename": "Math Software",
|
||||||
|
"path": "Machine Tips (Quantum)/Math/Math Software.md"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"omittedPaths": [],
|
"omittedPaths": [],
|
||||||
|
|
|
@ -52,20 +52,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/gdevelop.io.md",
|
"file": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md",
|
||||||
"mode": "source",
|
|
||||||
"backlinks": false,
|
|
||||||
"source": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "a4aa933fc978113e",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "markdown",
|
|
||||||
"state": {
|
|
||||||
"file": "Coding Tips (Classical)/Terminal Tips/Languages/C++.md",
|
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"backlinks": false,
|
"backlinks": false,
|
||||||
"source": false
|
"source": false
|
||||||
|
@ -86,7 +73,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"currentTab": 4
|
"currentTab": 3
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "vertical"
|
"direction": "vertical"
|
||||||
|
@ -148,7 +135,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Coding Tips (Classical)/Terminal Tips/Languages/C++.md"
|
"file": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -158,7 +145,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Coding Tips (Classical)/Terminal Tips/Languages/C++.md",
|
"file": "Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": false
|
"unlinkedCollapsed": false
|
||||||
}
|
}
|
||||||
|
@ -183,13 +170,11 @@
|
||||||
"audio-recorder:Start/stop recording": false
|
"audio-recorder:Start/stop recording": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "28a54cc81af4607b",
|
"active": "96c704143d6a5f29",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/gdevelop.io.md",
|
|
||||||
"Coding Tips (Classical)/Terminal Tips/Languages/C++.md",
|
|
||||||
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md",
|
|
||||||
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/Ruffle.md",
|
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/Ruffle.md",
|
||||||
"Coding Tips (Classical)/Terminal Tips/GUIs/Tools/StackBlitz.md",
|
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/Neopets.md",
|
||||||
|
"Coding Tips (Classical)/Terminal Tips/GUIs/Games/gdevelop.io.md",
|
||||||
"Coding Tips (Classical)/Terminal Tips/GUIs/Tools/Webscraping.md",
|
"Coding Tips (Classical)/Terminal Tips/GUIs/Tools/Webscraping.md",
|
||||||
"Coding Tips (Classical)/Project Vault/Obsidian/imgFiles/Pasted image 20230901074121.png",
|
"Coding Tips (Classical)/Project Vault/Obsidian/imgFiles/Pasted image 20230901074121.png",
|
||||||
"Machine Tips (Quantum)/Resources/Technologies, Orgs, & Apps/Applications/More specifically/Games!!/GDevelop/Making Games through GDevelop.md",
|
"Machine Tips (Quantum)/Resources/Technologies, Orgs, & Apps/Applications/More specifically/Games!!/GDevelop/Making Games through GDevelop.md",
|
||||||
|
@ -214,6 +199,8 @@
|
||||||
"Machine Tips (Quantum)/Resources/Quantum 101 - Alt. Resources.md",
|
"Machine Tips (Quantum)/Resources/Quantum 101 - Alt. Resources.md",
|
||||||
"Machine Tips (Quantum)/Resources/Welcome to Quantum 101.md",
|
"Machine Tips (Quantum)/Resources/Welcome to Quantum 101.md",
|
||||||
"Machine Tips (Quantum)/Resources/Post-Processing/QCVV.md",
|
"Machine Tips (Quantum)/Resources/Post-Processing/QCVV.md",
|
||||||
|
"Gitea .readme.md",
|
||||||
|
"Machine Tips (Quantum)/Physics/Particle Terms.md",
|
||||||
"Coding Tips (Classical)/Project Vault/Typewriter/gx6750.pdf",
|
"Coding Tips (Classical)/Project Vault/Typewriter/gx6750.pdf",
|
||||||
"Coding Tips (Classical)/Project Vault/Typewriter",
|
"Coding Tips (Classical)/Project Vault/Typewriter",
|
||||||
"Machine Tips (Quantum)/Project Vault/Papers/Shwetha Jayaraj CV.pdf",
|
"Machine Tips (Quantum)/Project Vault/Papers/Shwetha Jayaraj CV.pdf",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Ah, [neopets.com ](https://www.neopets.com/home/). The game of my youth. I spent so many hours, days, weeks, & years into this game. Now that I finally have my account back after so many years, the nostalgia is overwhelming. It truly was an excellent website. I never really got into club penguin or the other ones, but for me it was definitely Neopets.
|
Ah, [neopets.com ](https://www.neopets.com/home/). The game of my youth. I spent so many hours, days, weeks, & years into this game. Now that I finally have my account back after so many years, the nostalgia is overwhelming. It truly was an excellent website. I never really got into club penguin or the other ones, but for me it was definitely Neopets.
|
||||||
|
|
||||||
|
|
||||||
#### Other links:
|
Other links:
|
||||||
- Making those [cute linked buttons](https://www.sketchedneo.com/button-maker/) at the end of websites
|
- Making those [cute linked buttons](https://www.sketchedneo.com/button-maker/) at the end of websites
|
||||||
- Other [neopets site customization](https://www.sketchedneo.com/neopets-graphics/) freebies
|
- Other [neopets site customization](https://www.sketchedneo.com/neopets-graphics/) freebies
|
||||||
- Neopets-dedicated websites
|
- Neopets-dedicated websites
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
# C++
|
|
||||||
|
|
||||||
C++ is one of the most used languages out there for writing low-level code. There are various applications and projects based off of C++.
|
|
||||||
|
|
||||||
- A URL shortener in C++
|
|
||||||
- [gist](https://gist.github.com/jaytaylor/a11fadf61a869ade0dfe568606b216c8#file-base64-url-shortener-poc-cpp)
|
|
||||||
```c++
|
|
||||||
/**
|
|
||||||
* URL shortener Base-62 encoder / decoder C++ Proof-of-Concept.
|
|
||||||
*
|
|
||||||
* Created as a resource for https://stackoverflow.com/a/742047/293064.
|
|
||||||
*
|
|
||||||
* How to compile:
|
|
||||||
*
|
|
||||||
* g++ -o base64-url-shortener-poc base64-url-shortener-poc.cpp
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
*
|
|
||||||
* ./base64-url-shortener-poc [ID]
|
|
||||||
*
|
|
||||||
* Example output:
|
|
||||||
*
|
|
||||||
* Input ID: 99592
|
|
||||||
* ---
|
|
||||||
* Generated short URL: z4u
|
|
||||||
* ID decoded from URL: 99592
|
|
||||||
*
|
|
||||||
* @author Jay Taylor <outtatime@gmail.com>
|
|
||||||
*
|
|
||||||
* @date 2019-07-08
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <string>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id_to_short_url takes an input ID and produces a short URL suffix.
|
|
||||||
*
|
|
||||||
* Base-62 encodes the identifier.
|
|
||||||
*/
|
|
||||||
string id_to_short_url(unsigned int n) {
|
|
||||||
// Mapping which defines the 62 possible output characters.
|
|
||||||
char map[] = "abcdefghijklmnopqrstuvwxyzABCDEF"
|
|
||||||
"GHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
||||||
|
|
||||||
string short_url;
|
|
||||||
|
|
||||||
// Convert given ID to a base-62 number.
|
|
||||||
while (n) {
|
|
||||||
// Append each character mapped by the remainder.
|
|
||||||
short_url.push_back(map[n % 62]);
|
|
||||||
n /= 62;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reverse the string to complete the base conversion.
|
|
||||||
reverse(short_url.begin(), short_url.end());
|
|
||||||
|
|
||||||
return short_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* short_url_to_id converts a short URL into the corresponding ID.
|
|
||||||
*
|
|
||||||
* Base-62 decodes the input string.
|
|
||||||
*/
|
|
||||||
unsigned int short_url_to_id(string short_url) {
|
|
||||||
unsigned int id = 0;
|
|
||||||
|
|
||||||
// Base decode conversion logic.
|
|
||||||
for (int i = 0; i < short_url.length(); ++i) {
|
|
||||||
if ('a' <= short_url[i] && short_url[i] <= 'z') {
|
|
||||||
id = id * 62 + short_url[i] - 'a';
|
|
||||||
}
|
|
||||||
if ('A' <= short_url[i] && short_url[i] <= 'Z') {
|
|
||||||
id = id * 62 + short_url[i] - 'A' + 26;
|
|
||||||
}
|
|
||||||
if ('0' <= short_url[i] && short_url[i] <= '9') {
|
|
||||||
id = id * 62 + short_url[i] - '0' + 52;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
if (argc == 1) {
|
|
||||||
cerr << "error: missing required parameter: id" << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int n = atoi(argv[1]);
|
|
||||||
|
|
||||||
if (n <= 0) {
|
|
||||||
cerr << "error: invalid input value, an integer greater than 0 is required" << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "Input ID: " << n << endl << "---" << endl;
|
|
||||||
|
|
||||||
string encoded_short_url = id_to_short_url(n);
|
|
||||||
unsigned int decoded_id = short_url_to_id(encoded_short_url);
|
|
||||||
|
|
||||||
cout << "Generated short URL: " << encoded_short_url << endl;
|
|
||||||
cout << "ID decoded from URL: " << decoded_id << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
Loading…
Reference in New Issue