This file contains hidden or 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
//Add in text after price to all products | |
function custom_text_to_price( $price, $product ) { | |
$price = $price . ' USD'; | |
return $price; | |
} | |
add_filter( 'woocommerce_get_price_html', 'custom_text_to_price', 100, 2 ); |
This file contains hidden or 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
# dump all databases once every 24 hours | |
45 4 * * * root nice -n 19 su - postgres -c "pg_dumpall --clean" | gzip -9 > /var/local/backup/postgres/postgres_all.sql.gz | |
# vacuum all databases every night (full vacuum on Sunday night, lazy vacuum every other night) | |
45 3 * * 0 root nice -n 19 su - postgres -c "vacuumdb --all --full --analyze" | |
45 3 * * 1-6 root nice -n 19 su - postgres -c "vacuumdb --all --analyze --quiet" | |
# re-index all databases once a week | |
0 3 * * 0 root nice -n 19 su - postgres -c 'psql -t -c "select datname from pg_database order by datname;" | xargs -n 1 -I"{}" -- psql -U postgres {} -c "reindex database {};"' |
This file contains hidden or 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
""" | |
This script will check server response time in seconds. | |
""" | |
import requests | |
while True: | |
a = requests.get("your api url").elapsed.total_seconds() | |
print(a) |
This file contains hidden or 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
// Your page content display by this code | |
<?php if ( !post_password_required() ) { ?> | |
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; endif; ?> | |
<?php } ?> | |
This file contains hidden or 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
// Your page content display by this code | |
<?php if ( !post_password_required() ) { ?> | |
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile; endif; ?> | |
<?php } ?> | |
This file contains hidden or 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
Firstly import below modules in Python file or Django file . | |
1. csv | |
2. psycopg2 | |
Now Firstly create a connection with your database below way | |
try: | |
conn_string="dbname='user database name' user='database user name' host='localhost' password='your user password'" | |
print ("Connecting to database\n->%s" % (conn_string)) | |
conn = psycopg2.connect(conn_string) | |
print ("connection succeeded") | |
except: |
This file contains hidden or 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
Firstly You need to open your terminal then login | |
scp -r ursername@hostname:/path of your file or folder /home/where you want to save the folder or file | |
This command copy your file from remote server . | |
now if you want to send a file in your server then you can write down below command | |
scp -r /home/where you want to save the folder or file ursername@hostname:/path of your file or folder |
This file contains hidden or 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
First go to here https://www.apachefriends.org/download.html | |
Now copy the url | |
You will get the URL like this | |
https://www.apachefriends.org/xampp-files/7.1.4/xampp-linux-x64-7.1.4-0-installer.run | |
Now open your terminal and run the following command | |
wget https://www.apachefriends.org/xampp-files/7.1.4/xampp-linux-x64-7.1.4-0-installer.run | |
After that run this |
This file contains hidden or 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
#Update your apps by below command and install | |
$ sudo apt-get update | |
$ sudo apt-get install postgresql postgresql-contrib | |
#Connect to PostgreSQL | |
$ sudo su - postgres | |
$ psql | |
#Checking connection with user information |
This file contains hidden or 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
Requirements: | |
Operating System: Ubuntu 16.04 LTS | |
Android Developer Tools (ADT) installed | |
Steps: | |
Make sure that you have connected your Android device in USB Debugging mode | |
Press Ctrl + Alt + T for Terminal and use the following command: | |
lsusb |