Skip to content

Instantly share code, notes, and snippets.

View theodorosploumis's full-sized avatar
🏠
Working from home

Theodoros Ploumis theodorosploumis

🏠
Working from home
View GitHub Profile
@theodorosploumis
theodorosploumis / crontab_script.sh
Last active April 10, 2020 10:36 — forked from dcrystalj/startup.bat
Setup Cron jobs with crontab for Drupal 7.x and 8.x (also how to clear caches, flush image styles etc)
# Open crontab with nano
# env EDITOR=nano crontab -e
# Examples from https://crontab.guru
# 0 03 * * 1-5
# */15 * * * *
# 33 * * * *
0 03 * * 1-5 /usr/local/bin/curl "http://www.domain.com/cron.php?cron_key=vHhbh21L3NXkiF5wKb5QXg3EHCp1ODDvN5DM0gH9OzO" > /dev/null 2>&1
@theodorosploumis
theodorosploumis / libreoffice_left_join_tables
Last active August 29, 2015 14:11
LibreOffice left Join Tables using unique id
// INDIRECT (Turns text into a range, if that range is valid)
// MATCH (Returns the relative position of an item in an array that matches a specified value. The function returns the position of the value found in the lookup_array as a number.)
=INDIRECT("SheetName.G"&((MATCH($D2;SheetName.$A$2:$A$103;1)+1)))
@theodorosploumis
theodorosploumis / Drupal function update line items table
Last active August 29, 2015 14:11
Drupal 7: field_data_commerce_line_items table is empty after Feeds import.
/*
* Drupal 7: Using the latest EXPERIMENTAL Feeds module (7.x-2.x-dev from 2014-Dec-16) to import Commerce orders and line items the line items are not attached on each order.
* Technically, the database table "field_data_commerce_line_items" that keeps the reference for each order is empty
* and values only exist on "commerce_line_item" table. We are using Feeds to import data for "Orders" as also as "Product Line Items".
* With this simple function we fill up the "field_data_commerce_line_items" table from "commerce_line_item" table.
*/
// Update line items after feeds import (so table field_data_commerce_line_items has values)
function MYMODULE_update_product_line_items() {
@theodorosploumis
theodorosploumis / Git_shared_hosting.sh
Last active November 18, 2015 22:35
Install Git on Shared hosting (Tested with Freebsd)
#!/bin/bash -e
# IMPORTANT. You must have gcc and wget installed
echo -n "Please enter the Git branch (eg 2.6.2): "
read branch
echo -n "Perl path (run 'which perl' to find the path): "
read perl_path
# Add bin in PATH
@theodorosploumis
theodorosploumis / grstroupper.php
Last active August 29, 2015 14:17
Greek toUppercase converter
<?php
/**
* CodeIgniter String Helpers
*
* @package OpenReceptor CMS
* @subpackage Helpers
* @category Helpers
* @author Dimitris Krestos
* @link http://vdw.staytuned.gr
@theodorosploumis
theodorosploumis / change_limit_function.php
Created March 25, 2015 18:36
Change drupal text field limit
<?php
$field_to_update = 'field_text_field_to_extend'; //Replace with field slug
$new_chars = '500'; //Replace with extended character limit
$result1 = db_query('ALTER TABLE {field_data_'.$field_to_update.'} CHANGE '.$field_to_update.'_value '.$field_to_update.'_value VARCHAR('.$new_chars.')');
$result2 = db_query('ALTER TABLE {field_revision_'.$field_to_update.'} CHANGE '.$field_to_update.'_value '.$field_to_update.'_value VARCHAR('.$new_chars.')');
$result3 = db_query('SELECT CAST(data AS CHAR(10000) CHARACTER SET utf8) data FROM {field_config} WHERE field_name = \''.$field_to_update.'\'');
foreach ($result3 as $result) {
$data = $result->data;
@theodorosploumis
theodorosploumis / Vagrantfile
Last active February 18, 2019 10:36 — forked from anthonysterling/Vagrantfile
Windows IE Vagrantfile
# Usage: IE={box} vagrant up
#
# Eg. IE=XPIE6 vagrant up
boxes = {
"XPIE6" => "http://aka.ms/vagrant-xp-ie6",
"XPIE8" => "http://aka.ms/vagrant-xp-ie8",
"VistaIE7" => "http://aka.ms/vagrant-vista-ie7",
"Win7IE8" => "http://aka.ms/vagrant-win7-ie8",
"Win7IE9" => "http://aka.ms/vagrant-win7-ie9",
@theodorosploumis
theodorosploumis / Install_Phpstorm.sh
Last active June 16, 2022 11:15
Update phpstorm on Ubuntu linux.
#!/bin/bash -e
# IMPORTANT. My phpstom installation exists on /opt/phpstorm.
# Early Access program: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program
# For stable releases try: https://data.services.jetbrains.com/products/download?code=PS&platform=linux
if [ "$(whoami)" != "root" ]
then
echo "Sorry, you are not root."
exit 1
fi
function greeklish($string)
{
$replace_pairs = [
'Α' => 'A',
'Ά' => 'A',
'Β' => 'V',
'Γ' => 'G',
'Δ' => 'D',
'Ε' => 'E',
@theodorosploumis
theodorosploumis / local.settings.php
Created August 26, 2015 18:15
Drupal 7.x local.settings.php
<?php
/**
* @file
* This is a local development configuration file.
*/
global $conf;
// Turn off Secure Pages. Secure Pages Module.