Skip to content

Instantly share code, notes, and snippets.

@derekperkins
derekperkins / gist:6758647
Created September 30, 2013 02:19
tail -n 50 /var/log/syslog
root@local:/etc/samba# tail -n 50 /var/log/syslog
Sep 30 02:08:36 local dhclient: No working leases in persistent database - sleeping.
Sep 30 02:08:46 local smbd[27311]: [2013/09/30 02:08:46.972822, 0] printing/print_cups.c:110(cups_connect)
Sep 30 02:08:46 local smbd[27311]: Unable to connect to CUPS server localhost:631 - Connection refused
Sep 30 02:08:46 local smbd[26204]: [2013/09/30 02:08:46.978610, 0] printing/print_cups.c:487(cups_async_callback)
Sep 30 02:08:46 local smbd[26204]: failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Sep 30 02:09:01 local CRON[27313]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Sep 30 02:12:58 local dhclient: DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 3
Sep 30 02:13:01 local dhclient: DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 5
Sep 30 02:13:06 local dhclient: DHCPDISCOVER on eth1 to 255.255.255.2
@derekperkins
derekperkins / gist:6913080
Created October 10, 2013 04:32
ElasticSearch vagrant provision error
[2013-10-10T04:21:04+00:00] WARN: Cloning resource attributes for execute[grant-permissions] from prior resource (CHEF-3694)
[2013-10-10T04:21:04+00:00] WARN: Previous execute[grant-permissions]: /var/chef/cache/cookbooks/nozzle/recipes/database.rb:13:in `from_file'
[2013-10-10T04:21:04+00:00] WARN: Current execute[grant-permissions]: /var/chef/cache/cookbooks/nozzle/recipes/database.rb:17:in `from_file'
[2013-10-10T04:21:04+00:00] INFO: Found chef-client in /usr/bin/chef-client
================================================================================
Error executing action `install` on resource 'dpkg_package[/var/chef/cache/elasticsearch-0.90.3.deb]'
================================================================================
@derekperkins
derekperkins / gist:6913322
Created October 10, 2013 05:07
Stacktrace
Generated at 2013-10-10 04:49:33 +0000
Errno::ECONNREFUSED: Connection refused - Connection refused connecting to localhost:443 for /nodes/local.nozzle.io, giving up
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:300:in `rescue in retriable_rest_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:286:in `retriable_rest_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:167:in `raw_http_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:161:in `api_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:102:in `get'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/node.rb:473:in `load'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/node.rb:457:in `find_or_create'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:345:in `load_node'
@derekperkins
derekperkins / gist:6959368
Created October 13, 2013 07:52
Revamp provisioning
Derek@Derek /cygdrive/c/vagrant/nozzle-chef
$ vagrant up --provider=vmware_workstation
Bringing machine 'default' up with 'vmware_workstation' provider...
[default] Box 'derek-vagrant-revamp' was not found. Fetching box from specified URL for
the provider 'vmware_workstation'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading or copying the box...
Extracting box...ate: 1969k/s, Estimated time remaining: --:--:--)
@derekperkins
derekperkins / gist:6967559
Created October 13, 2013 21:21
Provision error
[2013-10-13T21:11:58+00:00] INFO: execute[apt-get-update-build-essentials] ran successfully
[2013-10-13T21:12:23+00:00] WARN: Cloning resource attributes for package[build-essential] from prior resource (CHEF-3694)
[2013-10-13T21:12:23+00:00] WARN: Previous package[build-essential]: /var/chef/cache/cookbooks/build-essential/recipes/debian.rb:40:in `block in from_file'
[2013-10-13T21:12:23+00:00] WARN: Current package[build-essential]: /var/chef/cache/cookbooks/mysql/recipes/client.rb:46:in `block in from_file'
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/mysql/recipes/server.rb
================================================================================
@derekperkins
derekperkins / gist:6967630
Created October 13, 2013 21:28
stacktrace
Generated at 2013-10-13 21:12:24 +0000
Net::HTTPServerException: 403 "Forbidden"
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2633:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:207:in `block in raw_http_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:289:in `retriable_rest_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:167:in `raw_http_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:161:in `api_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:128:in `put'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/node.rb:489:in `save'
/var/chef/cache/cookbooks/mysql/recipes/server.rb:42:in `from_file'
@derekperkins
derekperkins / gist:6987415
Created October 15, 2013 06:35
Composer error
[2013-10-15T06:12:40+00:00] INFO: Update package: /var/www/nozzle/htdocs
[2013-10-15T06:12:40+00:00] INFO: Install package in directory: /var/www/nozzle/ htdocs
[2013-10-15T06:12:40+00:00] WARN: Cloning resource attributes for execute[instal l-composer-packages] from prior resource (CHEF-3694)
[2013-10-15T06:12:40+00:00] WARN: Previous execute[install-composer-packages]: / var/chef/cache/cookbooks/composer/providers/package.rb:5:in `block in class_from _file'
[2013-10-15T06:12:40+00:00] WARN: Current execute[install-composer-packages]: /
<?php
function geocode($address) {
$apikey = "key=Fmjtd%7Cluub256a2u%2C2x%3Do5-9urwg6";
$url = "http://open.mapquestapi.com/geocoding/v1/address?";
$options = "&inFormat=kvp&outFormat=json&thumbMaps=false&maxResults=1";
$location = "&location=".urlencode($address);
$results = json_decode(file_get_contents($url.$apikey.$options.$location));
@derekperkins
derekperkins / gist:7462343
Created November 14, 2013 06:26
CakePHP ElasticsearchBehavior
<?php
class ElasticsearchBehavior extends ModelBehavior {
public function beforeFind(Model $Model, $query) {
if(!empty($query['conditions']['elastic'])) {
$Model->switchToElastic();
unset($query['conditions']['elastic']);
}
@derekperkins
derekperkins / gist:7596423
Created November 22, 2013 07:59
Elasticsearch Datasource Conditions
$query['conditions'] = [
'has_child' => [
'type' => 'workspaces_posts_tags',
'workspace_id' => 2
]
];