Skip to content

Instantly share code, notes, and snippets.

@dkvadratu
dkvadratu / http_headers_security.htaccess
Last active November 29, 2024 09:51
{HTACCESS} HTTP headers for security in .htaccess file
# Check your website headers here: https://www.serpworx.com/check-security-headers/ or https://gf.dev/
# This configuration works for WP, WC on LiteSpeed server. Be careful. Test site after installing. All lines are explained are in serpworx.com tester.
# More docs:
# https://www.netsparker.com/whitepaper-http-security-headers/#XFrameOptionsHTTPHeader
# https://owasp.org/www-project-secure-headers/
# https://www.keycdn.com/blog/http-security-headers
# WordPress plugin for Headers setup https://wordpress.org/plugins/http-headers/
# Main security options in .htaccess file:
  • Create aws ec2 instance of type Amazon Linux 2 AMI
  • Connect to the instance
  • Install Docker:
    • sudo yum update -y
    • sudo amazon-linux-extras install docker
    • sudo usermod -a -G docker ec2-user
    • reboot instance and reconnect
    • sudo service docker start
    • docker --version
<?php
// Create a product:
$productData = array(
'product' => array(
'title' => "Shopify Logo T-Shirt",
'price' => 19.99));
$shopifyResponse = performShopifyRequest(
$shop, $accessToken, 'products', $productData, 'POST'
@exAspArk
exAspArk / curl.sh
Last active October 18, 2025 13:48
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
<?php
//============ ============ ============ ============
// Convert html table to aray
//
// @auth: ViHoangSon
// @since: 20160704092752
//
// Using:
// $contents = "<table><tr><td>Row 1 Column 1</td><td>Row 1 Column 2</td></tr><tr><td>Row 2 Column 1</td><td>Row 2 Column 2</td></tr></table>";
// $array = ConvertHelper::getdata($contents);
@stracqan
stracqan / usb-credit-card-reader.js
Last active October 28, 2023 14:14
Very simple jQuery implementation that reads card data from a USB Magnetic Strip Credit Card Reader.
/**
*
* Simple jQuery Script to parse credit card data
* that was collected via a USB Magnetic Stripe
* Credit Card Reader.
*
* To get this to work, focus your cursor (either
* programmatically or via a click, it's your choice) on an input field #credit-card-number
* and then with the card reader plugged in, swipe
* the card and it will take over from there
@keithmorris
keithmorris / .htaccess
Created June 30, 2012 12:09
CodeIgniter .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]