Skip to content

Instantly share code, notes, and snippets.

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

Sanjay Rohila crazyrohila

🏠
Working from home
View GitHub Profile
@crazyrohila
crazyrohila / restore_db.sh
Created May 3, 2015 10:33
Rackspace-Cloud-DB-Restore-Script
#! /bin/bash
# Variables
rack_space_host=XXX.rackspaceclouddb.com
rack_space_user=abc
rack_space_pass=efg
rack_space_db=DB_Name
if [ -d $1 ]
then
@crazyrohila
crazyrohila / mini_pingdom
Last active August 29, 2015 14:23
Mini Pingdom
#! /bin/bash
RESO=`/usr/bin/curl -sI https://www.drupal.org | head -n 1 | awk -F " " '{print $2}'`
if [ $RESO -eq 200 ]
then
echo "All is well!!!"
else
echo "Hey!!! get to work, immediately" | mail -s "Hey! your site is down; better get to work" [email protected]
fi
@crazyrohila
crazyrohila / SassMeister-input.scss
Created August 7, 2015 15:06
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.story-box {
&__header {
font-weight: 500;
}
&:hover &__header {
text-decoration: underline;
@crazyrohila
crazyrohila / SassMeister-input.scss
Created December 7, 2015 09:59
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin placeholder($extend: true) {
@if($extend) {
@extend %placeholder;
}
@else {
@crazyrohila
crazyrohila / sublime_regex
Last active March 4, 2016 09:43
Sublime Regex
Set title same as value attribute
Find: value="chart*(\w+)"
Replace: value="chart$1" title="chart$1"
Set title same as text within element
Find: title="chart*(\w+)">*(.+?>)
Replace: title="$2">$2
Single attribute selection and replace
@crazyrohila
crazyrohila / DrupalCoder.sublime-build
Created July 13, 2016 12:05
DrupalCoder.sublime-build
{
"cmd": ["/Users/MYUSER/.composer/vendor/bin/phpcs", "--report=emacs", "--standard=Drupal", "--extensions=php,module,inc,install,test,profile,theme", "$file"],
"file_regex": "^(.*):(.*):(.*):(.*)$",
"variants": [
{
"name": "Run",
"cmd": ["/Users/MYUSER/.composer/vendor/bin/phpcbf", "--standard=Drupal", "--extensions=php,module,inc,install,test,profile,theme", "$file"]
}
]
}
@crazyrohila
crazyrohila / HighchartExport-ExtraInfo.js
Last active December 9, 2016 13:08
HighchartExport - Calculated column data (Extra data)
// If we want to export some more info or calculated column in export csv data
// we can create a fake series with minimal required props and then push to chart.series
// and highchart will export that.
var s = {
name: "Test2",
options: {
stickyTracking: true
},
points: [{
@crazyrohila
crazyrohila / update-field-instance.php
Created August 12, 2016 11:06
Update drupal field instance
<?php
$field = field_read_instance('node', 'field_xxx', '<content_type>');
$field['label'] = 'New Label';
field_update_instance($field);
@crazyrohila
crazyrohila / remove-old-images.md
Created November 25, 2016 06:28
Remove old images in boot dir

uname -r ##identify the kernel you are presently booting DO NOT remove this one ! Keep one other for a back up. dpkg -l | grep linux-image- ##identify all installed kernel images dpkg -l | grep linux-headers- ##identify all kernel header files sudo apt-get --purge remove linux-image-3.2.0-31-generic ##for example sudo apt-get --purge remove linux-headers-3.2.0-31-generic ##for example

@crazyrohila
crazyrohila / remove-old-images
Last active November 25, 2016 06:29
Remove old images in boot dir
uname -r ##identify the kernel you are presently booting DO NOT remove this one ! Keep one other for a back up.
dpkg -l | grep linux-image- ##identify all installed kernel images
dpkg -l | grep linux-headers- ##identify all kernel header files
sudo apt-get --purge remove linux-image-3.2.0-31-generic ##for example
sudo apt-get --purge remove linux-headers-3.2.0-31-generic ##for example