Notes I took while learning C++.
std::endl; -> No escape code | Adds a new line and flushes the buffer
std::cout << "\n"; -> New line | Recommended in most cases instead of "std::endl"
std::cout << "\t"; -> Horizontal Tab
File.ReadAllText(filePath);
-> Reads / Returns the data of a file as STRING
File.ReadAllLines(filePath);
-> Reads /Returns the contents of a file and stores each line at a new index in a STRING[]
File.ReadAllBytes(filePath);
-> Reads / Returns the contents of a file as binary data and stores the data in a BYTE[]
File.WriteAllText(filePath, data);
-> Overwrites the content with the content of a string variable
File.WriteAllLines(filePath, data);
-> Write content of a string array - each entry = new line
File.AppendAllText(filePath, data);
-> Appends STRING
File.AppendAllLines(filePath, data);
-> Append content of a string array
The null-conditional operator allows you to safely access properties or call methods on an object that might be null without causing a null reference exception.
Example: int? length = text?.Length;
String interpolation simplifies string formatting by allowing you to embed expressions directly within a string using the $ symbol.
Example: string name = "Alice"; string message = $"Hello, {name}!";
using MySqlConnector; | |
using Renci.SshNet; | |
class Program { | |
static void Main(string[] args) { | |
// SSH Connection Information | |
string sshHost = ""; // SSH server IP or hostname | |
string sshUsername = ""; // Debian run `whoami` | |
string sshPrivateKeyPath = ""; // Path to ED25519 private key | |
string sshPrivateKeyPassphrase = ""; // ED25519 private key passphrase |
using System; | |
using System.Security.Cryptography; | |
using System.Text; | |
public class Hasher { | |
private static readonly RandomNumberGenerator Rng = RandomNumberGenerator.Create(); | |
public string CreateHash(string input, byte[] salt, string pepper) { | |
byte[] saltBytes; | |
byte[] pepperBytes = Encoding.UTF8.GetBytes(pepper); |