Skip to content

Instantly share code, notes, and snippets.

@Aetopia
Created September 2, 2022 12:04
Show Gist options
  • Save Aetopia/e903c6532f6ce23aa96c4e64d06674fd to your computer and use it in GitHub Desktop.
Save Aetopia/e903c6532f6ce23aa96c4e64d06674fd to your computer and use it in GitHub Desktop.
Couleur's Pathed But in ©️!
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *strcmb(char *str1, char *str2, char *str3, char *str4)
{
// Combines and puts the combined string in memory.
char *str = (char *)malloc(strlen(str1) + strlen(str2) + strlen(str3) + strlen(str4) + 1);
sprintf(str, "%s%s%s%s", str1, str2, str3, str4);
return str;
}
int main(int, char *argv[])
{
char *site = strlwr(argv[1]);
char *query = argv[2];
char *link;
char *cmd;
for (int i = 0; i < strlen(query); i++)
{
if (query[i] == ' ')
{
query[i] = '+';
}
}
if (strcmp(site, "scoop") == 0)
{
link = "https://scoop.sh/#/apps?q=";
}
else if (strcmp(site, "extras") == 0)
{
link = "https://github.com/ScoopInstaller/Extras/search?q=";
}
else if (strcmp(site, "main") == 0)
{
link = "https://github.com/ScoopInstaller/main/search?q=";
}
else if (strcmp(site, "utils") == 0)
{
link = "https://github.com/couleur-tweak-tips/utils/search?q=";
}
else if (strcmp(site, "pys") == 0)
{
link = "https://duckduckgo.com/?q=Python+";
}
else if (strcmp(site, "ps") == 0)
{
link = "https://duckduckgo.com/?q=PowerShell+";
}
else if (strcmp(site, "rs") == 0)
{
link = "https://duckduckgo.com/?q=Rust+";
}
else if (strcmp(site, "crates") == 0)
{
link = "https://crates.io/crates/";
}
else if (strcmp(site, "tw") == 0)
{
link = "https://twitter.com/search?q=";
}
else if (strcmp(site, "twu") == 0)
{
link = "https://twitter.com/";
}
else if (strcmp(site, "tele") == 0)
{
link = "https://t.me/";
}
else if (strcmp(site, "aur") == 0)
{
link = "https://aur.archlinux.org/packages?K=";
}
else if (strcmp(site, "archpkg") == 0)
{
link = "https://archlinux.org/packages/?q=";
}
else if (strcmp(site, "wiki") == 0)
{
link = "https://wiki.archlinux.org/index.php?search=";
} // the one and only
else if (strcmp(site, "wikipedia") == 0)
{
link = "https://en.wikipedia.org/w/index.php?search=";
} // less based
else if (strcmp(site, "drive") == 0)
{
link = "https://drive.google.com/drive/search?q=";
}
else if (strcmp(site, "gh") == 0)
{
link = "https://github.com/search?q=";
} // GitHub search
else if (strcmp(site, "repo") == 0)
{
link = "https://github.com/";
} // GitHub repository/organization/user
else if (strcmp(site, "gist") == 0)
{
link = "https://gist.github.com/search?q=";
} // GitHub gists
else if (strcmp(site, "gm0") == 0)
{
link = "https://mail.google.com/mail/u/0/#search/";
}
else if (strcmp(site, "gm1") == 0)
{
link = "https://mail.google.com/mail/u/1/#search/";
}
else if (strcmp(site, "gm2") == 0)
{
link = "https://mail.google.com/mail/u/2/#search/";
}
else if (strcmp(site, "gm3") == 0)
{
link = "https://mail.google.com/mail/u/3/#search/";
}
else if (strcmp(site, "amazon") == 0)
{
link = "https://www.amazon.com/s?k=";
}
else if (strcmp(site, "amazonfr") == 0)
{
link = "https://www.amazon.fr/s?k=";
}
else if (strcmp(site, "amazonit") == 0)
{
link = "https://www.amazon.it/s?k=";
}
else if (strcmp(site, "amazonca") == 0)
{
link = "https://www.amazon.ca/s?k=";
}
else if (strcmp(site, "amazonuk") == 0)
{
link = "https://www.amazon.co.uk/s?k=";
}
else if (strcmp(site, "chocolatey") == 0)
{
link = "https://community.chocolatey.org/packages?q=";
}
else if (strcmp(site, "namemc") == 0)
{
link = "https://mine.ly/";;
}
else if (strcmp(site, "pwshgallery") == 0)
{
link = "https://www.powershellgallery.com/packages?q=";
}
else if (strcmp(site, "duckduckgo") == 0)
{
link = "https://duckduckgo.com/?q=";
}
else if (strcmp(site, "genius") == 0)
{
link = "https://genius.com/search?q=";
}
else if (strcmp(site, "google") == 0)
{
link = "https://www.google.com/search?q=";
}
else if (strcmp(site, "you") == 0)
{
link = "https://you.com/search?q=";
}
else if (strcmp(site, "emojipedia") == 0)
{
link = "https://emojipedia.org/search/?q=";
}
else if (strcmp(site, "stackoverflow") == 0)
{
link = "https://stackoverflow.com/search?q=";
}
else if (strcmp(site, "discordid") == 0)
{
link = "https://discord.id/?prefill=";
}
else if (strcmp(site, "ys") == 0)
{
link = "https://www.youtube.com/results?search_query=";
}
else
{
puts("Invalid Website!");
exit(1);
}
cmd = strcmb("start ", link, query, "");
puts(cmd);
system(cmd);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment