Skip to content

Instantly share code, notes, and snippets.

View freshjones's full-sized avatar

William Jones freshjones

View GitHub Profile
@freshjones
freshjones / gist:bc8b642e75fa5723582a
Created May 31, 2015 21:16
Mysql Run Secure Installation
sudo mysql_secure_installation
@freshjones
freshjones / gist:cb3606fc468f7cfd1b90
Last active August 29, 2015 14:21
Installing D7 from Drush
mysql -uroot -p -e "CREATE DATABASE mysite"
drush dl drupal-7.x
mv local.mysite.dev
cd local.mysite.dev
drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://YourMySQLUser:RandomPassword@localhost/mysite
@freshjones
freshjones / gist:8ae24b6f32ee44ea265d
Created April 30, 2015 22:43
save portion of node
<?php
$entity = node_load(33);
echo "on load: {$entity->field_test1[LANGUAGE_NONE][0]['value']}<br/>";
$entity->field_test1[LANGUAGE_NONE][0]['value']='test'.rand(10,100);
echo "before save: {$entity->field_test1[LANGUAGE_NONE][0]['value']}<br/>";
$entity2=new stdClass;
$entity2->nid=$entity->nid;
$entity2->vid=$entity->vid;
@freshjones
freshjones / gist:9881a2f39ee29aafc178
Last active August 29, 2015 14:19
Reloading apache solr 4.x without restarting
reload schema and query-side synonyms without restarting solr
http://www.example.com/solr/admin/cores?action=RELOAD&core=mycore
@freshjones
freshjones / gist:5378ea75609e3fc9cc8a
Created April 16, 2015 11:54
query override for search api solr direct parse to combine single and multi parsing options
$query = $call_args['query'];
if(!strlen($query)) return;
$q = strtolower($query);
$qArray = explode(" ", trim($q, ' "') );
$segments = array();
@freshjones
freshjones / gist:f5fbe15989eb80fc495b
Created March 14, 2015 22:13
Setting the default branch to something other than master
git symbolic-ref HEAD refs/heads/mybranch
@freshjones
freshjones / gist:2488191c9b375f82a4b1
Created March 14, 2015 21:48
Git remove remote branch tracking
git branch -rd remote/branch
@freshjones
freshjones / gist:486fe4794c19831a65e3
Created March 14, 2015 21:47
Git Setup for website deployment
#!/bin/sh
ENVPATH=/var/www/sites/example.com
git --work-tree=$ENVPATH/public/ checkout -f
rm $ENVPATH/public/build.*
docker inspect --format='{{ .State.Running }}' <container_name>
@freshjones
freshjones / gist:315a65f0caf59178c969
Last active August 29, 2015 14:14
Output port number if its an active port, blank if its not
netstat -ln | grep LISTEN | grep -o ':<portnum> ' | awk {'print substr($0,2)'}