Skip to content

Instantly share code, notes, and snippets.

@luisfc
luisfc / Import and export tables in MySQL
Last active January 14, 2019 21:01
Import and export tables in MySQL
#Generating table backup:
mysqldump databaseName tableName > backup.sql -u user -p
#Restore table backup:
mysql -u root -p databaseName < backup.sql
@luisfc
luisfc / Resize images in Ubuntu
Last active June 13, 2017 19:36
Resize images in Ubuntu
sudo apt-get install nautilus-image-converter
#After finish the installation restart nautilus
killall nautilus
@luisfc
luisfc / Create BASH Script Executable in whole System
Created April 19, 2017 14:54
Create BASH Script Executable in whole System
# Add execute permission to script
~/mipc> chmod +x script.sh
# Copy script in directory that your system.
# there are two directories to copy the executable script
# 1 - Only available for the user of the system - /usr/bin or /usr/local/bin
# 2 - For share in all users of the system - /usr/local/bin
#1 ~/mipc> sudo cp script.sh /usr/bin/script
#2 ~/mipc> sudo cp script.sh /usr/local/bin
@luisfc
luisfc / MainActivity.java
Created April 24, 2017 19:11 — forked from first087/MainActivity.java
Android Application : In-app Billing Example with Utility. Test app at https://play.google.com/store/apps/details?id=com.ethanf.in_app_billing_ex2
package com.ethanf.in_app_billing_ex2;
import com.ethanf.in_app_billing_ex2.util.IabHelper;
import com.ethanf.in_app_billing_ex2.util.Inventory;
import com.ethanf.in_app_billing_ex2.util.IabResult;
import com.ethanf.in_app_billing_ex2.util.Purchase;
import com.ethanf.in_app_billing_ex2.util.SkuDetails;
import android.os.Bundle;
import android.app.Activity;
package com.ethanf.in_app_billing_ex;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
import com.android.vending.billing.IInAppBillingService;
import android.os.Bundle;
//Iterate in Bundle
Bundle mBundle = data.getExtras();
for (String key : mBundle.keySet()) {
Log.e(key, mBundle.get(key).toString());
}
//Iterate in SharedPreferences
SharedPreferences myShPref = getSharedPreferences("mySharedPreferences", Context.MODE_PRIVATE);
@luisfc
luisfc / Switch PHP version
Last active May 23, 2017 04:58
Switch PHP version
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6
@luisfc
luisfc / How To Install Nginx on Ubuntu 16.04
Created May 23, 2017 16:32
How To Install Nginx on Ubuntu 16.04
NGINX UBUNTU UBUNTU 16.04
Introduction
Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy.
In this guide, we'll discuss how to get Nginx installed on your Ubuntu 16.04 server.
Prerequisites
Before you begin this guide, you should have a regular, non-root user with sudo privileges configured on your server. You can learn how to configure a regular user account by following our initial server setup guide for Ubuntu 16.04.
From the man page:
--user=user_name, -u user_name
--password[=password], -p[password]
These work:
-uuser_name -ppassword
-u user_name -ppassword
@luisfc
luisfc / Install phpMyAdmin Ubuntu 16.04 and php7-fpm
Created June 13, 2017 19:34
Install phpMyAdmin Ubuntu 16.04 and php7-fpm
sudo apt update
sudo apt install phpmyadmin
This is a : no need to think setup for Ubuntu 16.04 with php7-fpm already installed.
Then copy paste just before the last } of the file the following block into /etc/nginx/sites-avaliable/default
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;