Skip to content

Instantly share code, notes, and snippets.

View sanguis's full-sized avatar
👁️‍🗨️
DevOpsing all the things

Josh Beauregard sanguis

👁️‍🗨️
DevOpsing all the things
View GitHub Profile
@sanguis
sanguis / gist:5041331
Last active December 14, 2015 06:19
entityfieldquery for returnining distinct links to a taxonomy category for a term
<?php
$query = new SysbioEntityFieldQuery();
$query
->entityCondition('bundle', 'event')
->fieldCondition('field_event_type', 'tid', 'NULL', '!=')
->addTag('distinct')
;
$result = $query->execute();
$nids = $result['node'];
$fields = field_info_instances('node', 'event');
"exception": "Chef::Exceptions::Package: package[php5-cgi] (php::package line 22) had an error: Chef::Exceptions::Package: No version specified, and no candidate version available for php5-cgi",
"backtrace": [
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:241:in `run'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:322:in `block in run'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:321:in `each'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/why_run.rb:321:in `run'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider.rb:128:in `process_resource_requirements'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider.rb:104:in `run_action'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/resource.rb:603:in `run_action'",
"/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/l
@sanguis
sanguis / apc.ini
Last active December 16, 2015 09:39
apc settings for a shared nginx server
extension=apc.so
shm_segments=2
apc.shm_size = 150M
apc.user_ttl=7200
apc.gc_ttl=3600
apc.ttl=7200
apc.enable_cli=1
apc.stat=0
apc.stat_ctime=1
apc.file_update_protection=2
@sanguis
sanguis / ss.conf
Created April 30, 2013 14:11
nginx redirect ssl or domain to domain
server {
listen 80;
server_name support.knectar.com;
rewrite ^/(.*) https://rwww.example.com/$1 permanent;
}
server {
listen 443;
ssl on;
ssl_certificate /home/sites/certs/ssl-bundle.crt;
@sanguis
sanguis / efqbase.php
Created June 18, 2013 15:13
EntiryFieldQuery basic page that outputs "team" type nodea teaser views
<?php
/**
* Implements hook_menu().
*/
function team_menu() {
$items['team'] = array(
'title' => t('Team'),
'page callback' => 'team_page',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
@sanguis
sanguis / josh.conf
Last active December 19, 2015 18:48
nginx microcaching drupal
fastcgi_cache_path /dev/shm/microcache levels=1:2 keys_zone=microcache:5M max_size=1G inactive=2h;
map $http_cookie $cache_uid {
default nil; # hommage to Lisp :)
~SESS[[:alnum:]]+=(?<session_id>[[:alnum:]]+) $session_id;
}
map $request_method $no_cache {
default 1;
HEAD 0;
GET 0;
server {
server_name foo.com;
#root /home/sites/foo/public;
root /home/sites/foo/cs-bs;
index index.html index.htm index.php;
#htpasswd
auth_basic "Restricted";
auth_basic_user_file /home/sites/foo/passwd;
location = / {
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: 'localhost'
port: 25
@sanguis
sanguis / gist:8102272
Created December 23, 2013 18:35
reinstall x
sudo apt-get purge nvidia*
#remove xorg.conf
sudo apt-get --reinstall xserver-xorg-core libgl1-mesa-glx:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:i386 libgl1-mesa-dri:amd64
sudo dpkg-reconfigure xserver-xorg
sudo reboot
sudo apt-get install nvidia-current
#if this doesn't work
sudo apt-get install linux-headers-generic-pae
### Password Protect /administrator area
location ~ /administrator/.* {
auth_basic "Restricted";
auth_basic_user_file /var/www/prod.pac.cr/passwd;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm: