This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The code is from http://www.mcgarvie.net/2009/07/17/programming/php/php-generatecreate-strong-passwords-uuid-random-string made by Brian M McGarvie/ | |
/** | |
Perfect for: PASSWORD GENERATION | |
Options: variable length | |
generateRandStr(8) | |
result: 4sRBfahW | |
**/ | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Created as an alternative to an article demonstrating the use of regular expressions to parse HTML: | |
// http://www.web-development-blog.com/archives/parse-html-with-preg_match_all/ | |
/** | |
* @param string $remoteUrl | |
* @param string $yourLink | |
* @return bool | |
*/ | |
function check_back_link($remoteUrl, $yourLink) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## SSH - Remote export > local import | |
ssh USER@HOST mysqldump -uREMOTEDATABASEUSER -pREMOTEDATABASEPASSWORD -hREMOTEHOST REMOTEDATABASENAME | mysql -uLOCALDATABASEUSER -pLOCALDATABASEPASSWORD LOCALDATABASENAME | |
## Export to CSV | |
mysql -uUSER -pPASS DATABASENAME -B -e "select * from \`korisnici\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv | |
## Export to CSV 2 | |
mysql -uUSER -pPASS DATABASE -B -e "SELECT users.uid AS 'ID', users.name AS 'Username', users.mail AS 'Email', from_unixtime(users.created) AS 'Created', from_unixtime(users.login) AS 'Last login' FROM users WHERE users.status=1 AND users.login!=0 ORDER BY users.login DESC;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > vehicle_categories.csv | |
## Export to SQL gzipped file with compression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DBNAME=<database_name> | |
TABLE=<table_name> | |
FNAME=/path/to/output/dir/$(date +%Y.%m.%d)-$DBNAME.csv | |
#(1)creates empty file and sets up column names using the information_schema | |
mysql -u <username> -p<password> $DBNAME -B -e "SELECT COLUMN_NAME FROM information_schema.COLUMNS C WHERE table_name = '$TABLE';" | awk '{print $1}' | grep -iv ^COLUMN_NAME$ | sed 's/^/"/g;s/$/"/g' | tr '\n' ',' > $FNAME | |
#(2)appends newline to mark beginning of data vs. column titles | |
echo "" >> $FNAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.mysqltutorial.org/import-csv-file-mysql-table/ | |
------------------------------------------------------------ | |
Import CSV File Into MySQL Table | |
This tutorial shows you how to use the LOAD DATA INFILE statement to import CSV file into MySQL table. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 2.11.6 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Host: localhost:3306 | |
-- Generation Time: Jan 11, 2013 at 04:24 PM | |
-- Server version: 5.0.51 | |
-- PHP Version: 5.2.5 | |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Shell script to backup MySQL database | |
# Set these variables | |
MyUSER="" # DB_USERNAME | |
MyPASS="" # DB_PASSWORD | |
MyHOST="" # DB_HOSTNAME | |
# Backup Dest directory | |
DEST="" # /home/username/backups/DB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sudo pip3 install mysqlclient fails with mysql_config not found | |
sudo apt-get install libmysqlclient-dev | |
#without pip3 it will not going to work for python3 | |
sudo pip3 install mysqlclient | |
# to run django migration | |
python3 manage.py migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="https://dobermandan.iljmp.com/improvely.js"></script> | |
<script type="text/javascript"> | |
improvely.init('dobermandan', 1); | |
improvely.conversion({ | |
goal: 'sale', | |
revenue: <?php echo $_POST['Total']; ?>, | |
reference: '<?php echo $_POST['orderID']; ?>' | |
}); | |
</script> |