Skip to content

Instantly share code, notes, and snippets.

View drakakisgeo's full-sized avatar

Drakakis George drakakisgeo

View GitHub Profile
@drakakisgeo
drakakisgeo / Greekports.json
Created September 25, 2017 11:24
Greek Ports destinations-departures pairs from forthcrs
{
"departures": {
"from": [
{
"code": "PNA",
<?php
namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;
class ModelFactoryHelper extends Command
{
/**
@drakakisgeo
drakakisgeo / gist:e0d21a04cc7b0f888e373bd02d156534
Created January 31, 2017 16:30
Debug Sql queries executed in Laravel app
DB::enableQueryLog();
... query ...
... query ...
... query ...
... query ...
dd(DB::getQueryLog());
@drakakisgeo
drakakisgeo / Check Spam source
Created December 2, 2016 07:58
Check Spam sourcein a shared server
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n
More info at http://www.inmotionhosting.com/support/email/exim/find-spam-script-location-with-exim
@drakakisgeo
drakakisgeo / gist:4f33f18e2751247eebb3195c97645075
Last active April 27, 2016 11:35
How to change document root in Cpanel
You must edit the file:
/var/cpanel/userdata/USERNAME/DOMAIN.COM
and change the line:
documentroot: /home/USERNAME/public_html
to
documentroot: /home/USERNAME/public_html/DOMAIN.COM
@drakakisgeo
drakakisgeo / GAFB
Created December 8, 2015 17:59
Add Google Analytics and FB tracking to html files
#!/bin/sh
FBCODE_ID='xxxxxxxxxx'
GACODE='xxxxxxxx'
FBBLOCK=$(cat <<EOF
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
@drakakisgeo
drakakisgeo / google-analytics-for-static-sites.sh
Created December 8, 2015 15:22 — forked from stevenscg/google-analytics-for-static-sites.sh
Add Google Analytics tracking to an existing static website
#!/bin/sh
#
# Add a Google Analytics tag to static website files
# @see http://adambuchanan.me/post/26345221717/updating-google-analytics-code-on-many-static-pages
# Tested on MacOS 10.8.X
#
# Usage:
# Set the GA parameters below
# Execute the script from the top-level of the static site
#
@drakakisgeo
drakakisgeo / gist:393b7bdff9e1074679ff
Created September 21, 2015 12:24
My deployphp/deployer notes
1. Make sure the ssh public key of your development is added to the live server. This way you won't need a passowrd. Test this by connecting to it directly ssh user@liveserver
2. Login to live server by `ssh user@liveserver` and create a new ssh key by `ssh-keygen`. MAKE SURE NOT TO INSERT A PASSWORD.
3. Add this public key to your bitbucket or github account that your repository is stored.
4. Make sure that the deploy.php script connects to git without https, for example = set('repository', '[email protected]:gdrakakis/checkout.git');
5. Run dep deploy production -vvv to see exacty the running comands.
CPANEL users
---------------
If you can't connect to your live server with ssh, make sure that the user can connect to the server with SSH.
To do this go to "Manage Shell Access" of WHM, select the user and assign him "Normal Shell*"
@drakakisgeo
drakakisgeo / gist:a8bfd7a3f1dddde2cff9
Created July 20, 2015 14:19
RestWs in Drupal Installation ~ Drush
drush dl restws
drush en restws
drush role-add-perm 'anonymous user' 'access resource node'
clip < ~/.ssh/id_rsa.pub