Skip to content

Instantly share code, notes, and snippets.

@keithweaver
keithweaver / domain-to-aws-ec2-instance.md
Created March 20, 2017 23:49
Point Domain to Amazon Web Services (AWS) EC2 Instance

Point Domain to Amazon Web Services (AWS) EC2 Instance

  1. Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
  2. If you are new to Amazon Route 53, you see a welcome page; choose Get Started Now for DNS Management. Otherwise, choose Hosted Zones in the navigation pane.
  3. Choose Create Hosted Zone.
  4. For Domain Name, type your domain name.
  5. Choose Create.
  6. Click the Hosted Zone, edit record set.
  7. In the value, add ec2-54-152-134-146.compute-1.amazonaws.com.
  8. Change your DNS file to point to the IPv4 address (This would be in something like GoDaddy).
@leogopal
leogopal / youtube-id.php
Last active July 5, 2021 15:37
PHP function to get youtube ID from URL
<?php
function get_youtube_video_ID($youtube_video_url) {
/**
* Pattern matches
* http://youtu.be/ID
* http://www.youtube.com/embed/ID
* http://www.youtube.com/watch?v=ID
* http://www.youtube.com/?v=ID
* http://www.youtube.com/v/ID
* http://www.youtube.com/e/ID
@web2ls
web2ls / Sticky Footer
Last active July 5, 2017 09:07
Sticky Footer
@tinogomes
tinogomes / DNS_TO_LOCALHOST.markdown
Last active May 16, 2026 09:03
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com
function genScreenshot() {
var canvasImgContentDecoded;
html2canvas(document.body, {
onrendered: function(canvas) {
window.canvasImgContentDecoded = canvas.toDataURL("image/png");
}
});
}
genScreenshot();
@HoangPV
HoangPV / session_example_config.php
Last active May 19, 2021 16:26
PHP MySQL Login System
<?php
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'Hoang123');
define('DB_NAME', 'session_example');
define('DB_SERVER', 'localhost');
/* Attempt to connect to MySQL database */
/** @var mysqli $mysqli */
$mysqli = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
@anunay
anunay / dump-database.sh
Last active November 7, 2024 14:05
MYSQL : Dump database with procedures, functions, views & triggers.
#Export database with all procedures, functions, views & triggers along with the table structures and their data.
mysqldump <other mysqldump options> --routines export.sql
@Guibzs
Guibzs / .htaccess
Last active March 26, 2023 15:17
Symfony 4 ~ .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
@ChiranjeeviAdi
ChiranjeeviAdi / dbconnect.php
Last active November 1, 2024 17:04
(Datatables) Server Side Pagination using PHP,MYSQL,Jquery
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "testusersdb";
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@alexjlockwood
alexjlockwood / .block
Last active February 15, 2022 10:01
Radial Dendrogram
license: gpl-3.0
border: no
height: 900