Skip to content

Instantly share code, notes, and snippets.

@LQ80
LQ80 / iptables_forward.txt
Last active September 3, 2021 14:55
iptables forward
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth0 -d 192.168.1.36 -p tcp --dport 8080 -j DNAT --to-destination 192.168.0.36:80
Other Commands:
===============
iptables -F
iptables -F -t nat
iptables -S
@LQ80
LQ80 / MS_SQL_-_Export_Binary_field_to_file.txt
Last active May 1, 2021 21:47
MS SQL - Export Binary field to file
bcp "SELECT [filedata] FROM [database].[dbo].[files] where [id] = {ID NUMBER}" queryout "{OUTPUT FILE NAME}" -S {MS SQL SERVAER NAME}\SQLEXPRESS -T -f bcp.fmt
@LQ80
LQ80 / backup_mysql_databases.bat
Created May 1, 2021 21:39
Backup MySQL Databases Batch File
@echo off
SET DIR="c:\wamp64\bin\mysql\mysql5.7.28\data\*"
FOR /D %%i IN (%DIR%) DO (
c:\wamp64\bin\mysql\mysql5.7.28\bin\mysqldump.exe -u root %%~nxi > DB\%%~nxi.sql
ECHO %%~nxi.sql
)
@LQ80
LQ80 / .htaccess
Created March 9, 2021 21:40
Protect directory by PHP session
RewriteEngine on
RewriteCond %{HTTP_COOKIE} !mycookie=logged_in
RewriteRule ^ - [F]
@LQ80
LQ80 / gist:0218277a0721a252762db8698e551773
Created May 29, 2020 17:32 — forked from tinogomes/DNS_TO_LOCALHOST.markdown
Public DNS Pointing To localhost (127.0.0.1)

Available Wildcarded DNS Domains

It turns out that some kind hearted people already set up wildcarded domains for you already. You can use any top level domain below and any subdomain of these and they will always resolve back to 127.0.0.1 (your local machine). Here's the list of ones I know about. Let me know if there are more!

  • *.fuf.me - Managed by @fidian; it will always point to localhost for IPv4 and IPv6
  • localtest.me - Also has an SSL cert - see http://readme.localtest.me
  • 127-0-0-1.org.uk
  • vcap.me
  • yoogle.com
  • lvh.me
@LQ80
LQ80 / addUsers.vbs
Last active May 5, 2020 21:24
hMailServer Create User Accounts
'hMailServer Create User Accounts:
'=================================
'
'This also requires a CSV file called Users.csv in the same directory as the script. The CSV is in the following format:
'username,password,domain
Option Explicit
Dim obBaseApp
Dim objFSO
@LQ80
LQ80 / utf8-arabic-ci.md
Created March 8, 2020 08:45 — forked from TheAhmedGad/utf8_arabic_ci.md
Add Arabic UTF8-ARABIC-CI Collation to MYSQL ENGINE

Support Arabic CI Collation

To make mysql understand Arabic letters synonyms like "أ" and "إ"

  • Run This to get Collation Path SHOW VARIABLES LIKE 'character_sets_dir';

  • in /collation/path/Index.xml add this to <charset name="utf8"> section

@LQ80
LQ80 / mysql_backup_databases.bat
Created January 22, 2020 09:52
MySQL Backup Databases
for /f %%x in ('mysql.exe -u root -p -e "show databases" -s --skip-column-names') do (
mysqldump.exe -u root --databases %%x > .\databases\%%x.sql
)
@LQ80
LQ80 / mysql_show_databases.bat
Created January 21, 2020 10:33
MySQL Show Databases
mysql -u root -p -e "show databases" -s --skip-column-names
@LQ80
LQ80 / arabic.xml
Created October 28, 2019 22:23
PHPMaker 2020 - Arabic Language
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ew-language date="2019/08/06" version="16.0.0" id="ar" name="Arabic" desc="Arabic" author="saleh alsharif.">
<!--
*** Important Notes:
1. Language ID should follow: https://developers.google.com/recaptcha/docs/language,
2. Locale settings are placed in a separate locale files under the "locales" folder,
3. Locale files must be named with language ID of language file (and converted to lowercase), e.g. en.json,
4. Locale files are ALWAYS used, regardless of whether the project is single language or multiple language.
-->
<global>