Skip to content

Instantly share code, notes, and snippets.

View 18520339's full-sized avatar
😵
Night Owl

Quan Dang 18520339

😵
Night Owl
View GitHub Profile
@18520339
18520339 / optimize_basic_functions.cpp
Last active January 31, 2025 21:30
My study notes
#include <iostream>
#include <math.h>
using namespace std;
bool is_prime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i += 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
@18520339
18520339 / simple-encrypt-virus.cpp
Last active August 24, 2021 15:38
Simple encrypt virus in C++
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream EncodeFile("encode.jpg", ifstream::binary);
ofstream DecodeFile("decode.jpg", ofstream::binary);
if (EncodeFile) {
EncodeFile.seekg (0, EncodeFile.end);
@18520339
18520339 / eicar.com
Created February 2, 2021 15:34
Test Antivirus
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
@18520339
18520339 / index.html
Last active April 9, 2021 20:09
Access Camera & Micro - https://teststream.web.app/
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<div class="select">
<label for="audioSource">Audio source: </label>
<select id="audioSource"></select>
@18520339
18520339 / files_folders.cpp
Last active August 24, 2021 15:43
Design Patterns - Composite
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Item {
protected:
string ten;
public:
@18520339
18520339 / find_longest_substring.cpp
Last active October 15, 2021 11:42
Tìm chuỗi con chung dài nhất
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int lookup[100][100];
// Đổ dữ liệu cho mảng lookup bằng cách tìm độ dài của dãy con chung
int LCSLength(string s1, string s2, int l1, int l2) {
// Hàng đầu tiên và cột đầu tiên của mảng lookup bằng 0 vì mảng lookup đã được khai báo toàn cục
@18520339
18520339 / binary_search.bas
Last active February 25, 2022 17:40
Tìm kiếm nhị phân bằng VBA
Function BinarySearch(strArray() As String, strSearch) As Long
Dim Left As Long, Middle As Long, Right As Long
Left = 1
Right = UBound(strArray, 1)
Do While Left <= Right
Middle = Left + (Right - Left) / 2
If strSearch = strArray(Middle, 1) Then
BinarySearch = Middle