Skip to content

Instantly share code, notes, and snippets.

View jsan-codes's full-sized avatar

Jessie Sanchez jsan-codes

View GitHub Profile
@jsan-codes
jsan-codes / gist:2dbcf0a0db448c2154ed31656947a77e
Created January 11, 2024 08:56
password hash salt algo in powershell for sql database
function Get-SaltedHash($password, $salt) {
$combined = [System.Text.Encoding]::UTF8.GetBytes($password + $salt)
$hash = [System.Security.Cryptography.SHA256]::Create().ComputeHash($combined)
return [System.BitConverter]::ToString($hash).Replace("-", "")
}
function Get-Salt($length) {
$saltBytes = new-object byte[] $length
(new-object System.Security.Cryptography.RNGCryptoServiceProvider).GetBytes($saltBytes)
return [System.BitConverter]::ToString($saltBytes).Replace("-", "")
<?php
$username = "admin";
$password = "admin123";
$hostname = "db-test.cor3jwxwqzct.us-west-1.rds.amazonaws.com";
$dbname = "test";
//Connect to database
$conn = new mysqli($hostname, $username, $password)
or die("Unable to connect to MySQL");
#!/bin/bash
## Auto webserver config for Amazon EC2
## External Database
yum update -y
yum install -y httpd php mysql php-mysql
rm -f /var/www/html/index.html
service httpd start
echo 'Index page created successfully' > /var/www/html/index.php
@jsan-codes
jsan-codes / permissions.json
Last active August 17, 2020 00:36
AWS S3 Public Permissions JSON
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@jsan-codes
jsan-codes / GMAIL MX Records
Last active April 8, 2022 10:13
GMAIL MX Records
1 aspmx.l.google.com
5 alt1.aspmx.l.google.com
5 alt2.aspmx.l.google.com
10 alt3.aspmx.l.google.com
10 alt4.aspmx.l.google.com