Skip to content

Instantly share code, notes, and snippets.

View eduardo-g-silva's full-sized avatar

Eduardo G. Silva eduardo-g-silva

View GitHub Profile
@eduardo-g-silva
eduardo-g-silva / git-ssh-error-fix.sh
Created July 10, 2021 10:29 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone [email protected]:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@eduardo-g-silva
eduardo-g-silva / gist:3b8d0bd42a3b83da3b6a1f4ef240c804
Created June 2, 2020 14:37
Do you want to become a web developer ?
Learn git and make an account
https://www.youtube.com/watch?v=USjZcfj8yxE
<?php
require_once('vendor/autoload.php');
$file = file_get_contents('/<path-to-output-file>/wpcore.txt', true);
$pushbullet = new PHPushbullet\PHPushbullet('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
$pushbullet->device('LGE Nexus 5')->note('my server', $file);
$pushbullet->user('[email protected]')->note('my server', $file);
#!/bin/bash
wp core verify-checksums --path=/<path-to-wp-folder> &> /<path-to-temp-folder-to-compare-outputs>/wpcore.txt
if ! comm -3 <(sort /<path-to-temp-folder-to-compare-outputs>/wpcore-master.txt) <(sort /<path-to-temp-folder-to-compare-outputs>/wpcore.txt) | grep -q '.*'; then
echo "all fine folks"
else
php -f /<path-to-php-file-that-send-message>/phpushbullet/oe-push.php
fi
@eduardo-g-silva
eduardo-g-silva / artisan-error-shared-hosting
Created November 5, 2016 15:46
Laravel open_basedir error runing Artisan in a shared hosting
If you are trying to run Artisan in shared and secure hosting and you are getting this type of error
php artisan migrate
[ErrorException]
is_file(): open_basedir restriction in effect. File(/usr/local/bin/php) is
not within the allowed path(s): (/usr/local/apache/htdocs:/tmp:/usr/local/l
ib/php:/usr/share:/etc/xml:/etc/pki:/usr/bin-safe:/home:/home2:/home3)
You can comment the is_file() function at the following vendor:
@eduardo-g-silva
eduardo-g-silva / magento-clear-var-logs
Created March 7, 2016 11:20
magento 1.x php script to clean cache and logs
<?php
/**
* Magento Maintenance Script
*
* @version 3.0.1
* @author Crucial Web Hosting <[email protected]>
* @copyright Copyright (c) 2006-2013 Crucial Web Hosting, Ltd.
* @link http://www.crucialwebhost.com Crucial Web Hosting
*/
@eduardo-g-silva
eduardo-g-silva / magento-clean-logs
Created March 7, 2016 11:14
Cleaning logs in magento 1.x
SET foreign_key_checks = 0;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
@eduardo-g-silva
eduardo-g-silva / barcode-link
Last active February 25, 2016 13:42
barcode link from chart googleapis
// the code it is very simple:
// first get the table with the data and then use the wp
// update_post_meta with update the value base on the post id
// and wp_set_object_terms to change the custom categories
// with true at the end to append the category without delete the existing.
add_shortcode('myFunction', update_geolocation');
function update_geolocation() {
$sql = "select Post_id, Lat, Lon from tblGeodatawithposts";
global $wpdb;