Skip to content

Instantly share code, notes, and snippets.

View nkgokul's full-sized avatar

Gokul N K nkgokul

View GitHub Profile
@nkgokul
nkgokul / drupal6installation.sh
Created July 20, 2016 08:25
Drupal 6 installation
mkdir sites/default/files
chmod a+w sites/default/files
cp sites/default/default.settings.php sites/default/settings.php
chmod a+w sites/default/settings.php
// Goto the weburl and install
chmod go-w sites/default/settings.php
chmod go-w sites/default/services.yml
@nkgokul
nkgokul / missing_node_ids.sql
Created June 28, 2016 11:04
Missing nids from node table
SELECT (t1.nid + 1) as gap_starts_at,
(SELECT MIN(t3.nid) -1 FROM node t3 WHERE t3.nid > t1.nid) as gap_ends_at
FROM node t1
WHERE NOT EXISTS (SELECT t2.nid FROM node t2 WHERE t2.nid = t1.nid + 1)
HAVING gap_ends_at IS NOT NULL
@nkgokul
nkgokul / Git Force Clearn
Last active July 25, 2016 13:10
Git Force Clean local and pull from server
sudo git clean -df && sudo git stash && git status
@nkgokul
nkgokul / Fixing Git issues
Last active June 23, 2016 11:27
Fixing Git issues
#Goto the root of git repo
cd .git
sudo chgrp -R users .
sudo chmod -R g+rwX .
sudo find . -type d -exec chmod g+s '{}' +
git config core.sharedRepository group
@nkgokul
nkgokul / for_all_content_types_in_drupal.sh
Created August 5, 2015 11:30
For all content types in drupal
#!/bin/bash
drush sqlq "select type from node_type" | while read content_type;
do
echo "Changing comment settings for $content_type"
drush vset comment_default_mode_$content_type 0
drush vset comment_default_per_page_$content_type 50
drush vset comment_$content_type 2
drush vset comment_form_location_$content_type 1
drush vset comment_preview_$content_type 0
drush vset comment_subject_field_$content_type 0
@nkgokul
nkgokul / comment_view.php
Created May 30, 2015 10:43
Comment View Export
$view = new view();
$view->name = 'testcomments';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'comment';
$view->human_name = 'Test Comments';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@nkgokul
nkgokul / drush_sql_dump_with_timestamp.sh
Last active March 29, 2019 13:36
Drush SQL dump with timestamp
drush sql-dump > project_dev1.$(date +%Y%m%d\-%H%M).sql
drush sql-dump > ${PWD##*/}-$(date +%Y-%m-%d\-%H-%M).sql
@nkgokul
nkgokul / git_ubuntu_latest.sh
Created April 6, 2015 06:43
Ubuntu update Git
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git
git --version
@nkgokul
nkgokul / get_field_types.js
Last active August 29, 2015 14:17
Getting Field types and its keys from content creation page in Drupal 8
var options = '';
jQuery('.form-item-new-storage-type select option').each(function(){
options = options + (jQuery(this).text() + '<<' + jQuery(this).val() + '\n');
});
console.log(options);
/**
* Copy paste the output from console.log to Google Spreadsheet
* You can use =SPLIT(A1,"<<"); function to split the key value pairs.
* /
@nkgokul
nkgokul / import_mails_from_a_particular_label.js
Created March 18, 2015 20:36
Import Mails that have particular label
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();