Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thatxliner/rrd
Rick Roll Detector. My first C++ project that uses CMake and external libraries. Now with comments so you can, too!
https://github.com/thatxliner/rrd
cmake cmake-examples cpp example example-code example-project
Last synced: 28 days ago
JSON representation
Rick Roll Detector. My first C++ project that uses CMake and external libraries. Now with comments so you can, too!
- Host: GitHub
- URL: https://github.com/thatxliner/rrd
- Owner: ThatXliner
- Created: 2021-06-12T02:33:32.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-25T16:14:58.000Z (about 3 years ago)
- Last Synced: 2024-11-02T12:25:45.620Z (3 months ago)
- Topics: cmake, cmake-examples, cpp, example, example-code, example-project
- Language: CMake
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RRD
[**R**ick **R**oll](https://www.youtube.com/watch?v=dQw4w9WgXcQ "Rickrolling - Wikipedia") **D**etector
---
### Why
I wanted to learn C++. I already know the syntax (mostly) and I wanted to test myself with using C++ and external libraries
#### Why not Python
The entire program can be written in **1 line of Python**:
```python
import re,urllib.request,sys;print("Usage: rrd URL" if len(sys.argv) < 2 else "Possible rickroll detected" (if re.search(r"((rick\s*roll)|(never\s*gonna\s*(give\s*you\s*up)?)|(dQw4w9WgXcQ))", urllib.request.urlopen(sys.argv[1]).read().decode()) else "No rickroll detected"));sys.exit(1 if len(sys.argv) < 2 else 0)
```or 4 lines, conforming very closely to my C++ program
```python
import re, urllib.request, sysREGEX = re.compile(r"((rick\s*roll)|(never\s*gonna\s*(give\s*you\s*up)?)|(dQw4w9WgXcQ))")
if len(sys.argv) < 2:
print("Usage: rrd URL")
sys.exit(1)
with urllib.request.urlopen(sys.argv[1]) as f:
print(
"Possible rickroll detected"
if REGEX.search(f.read().decode())
else "No rickroll detected"
)
```But come on, that defeats the purpose of this project.
### Installation
1. Download source
```bash
git clone https://github.com/ThatXliner/rrd.git
cd rrd
```2. Generate makefiles
```bash
cmake .
```[*Hey it fails!*](#troubleshooting)
3. Build the program
```bash
make
```4. Enjoy
```bash
./rrd 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
```
(or, on Windows)
```powershell
.\rrd 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
```### Help
#### Troubleshooting
**Running `cmake .` doesn't work!**
This part took me a TON of time.
If you're on Mac and have [homebrew](https://brew.sh) (and you can run it), run
```bash
brew upgrade
brew update
brew install openssl
```Should fix your problems. I forgot what worked for me but at some point, re-installing OpenSSL was all that I needed.