Skip to content

Instantly share code, notes, and snippets.

View wilsolutions's full-sized avatar
😀

Wils wilsolutions

😀
View GitHub Profile
I am trying to setup redis sentinel in 2 vms, this is my setup:
- 10.1.8.36 mymaster
- 10.1.8.46 resque (redis.conf = slaveof 10.1.8.36)
- in both mnachines /etc/redis-sentinel.conf
port 26379
sentinel monitor mymaster 10.1.8.36 6379 1
sentinel down-after-milliseconds mymaster 5000
Error:
2011/03/15 17:07:12 [crit] 7836#0: *7 connect() to unix:/tmp/phpfpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: wils.drupal7.com.br, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/phpfpm.sock:", host: "wils.drupal7.com.br"
---
Cause: PHP-FPM misconfiguration.
---
Solution:
1 - Check the php-fpm configuration: vi /etc/php-fpm.d/www.conf
2 - Comment the line ";listen = 127.0.0.1:9000"
3 - Add the line: listen = /tmp/phpfpm.sock
4 - Restart: /etc/init.d/php-fpm restart
@wilsolutions
wilsolutions / gist:96e3ae1310ccae86d344
Created January 29, 2015 17:48
XCTest + CoreData = EXC_BAD_ACCESS(code=EXC_i386_GPFLT)
<unknown>:0: error: -[apiTests testExample] : failed: caught "NSInvalidArgumentException", "*** -[NSURL initFileURLWithPath:]: nil string parameter"
(
0 CoreFoundation 0x007321e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x004ac8e5 objc_exception_throw + 44
2 CoreFoundation 0x00731fbb +[NSException raise:format:] + 139
3 Foundation 0x000c592b -[NSURL(NSURL) initFileURLWithPath:] + 123
4 Foundation 0x000c57fd +[NSURL(NSURL) fileURLWithPath:] + 67
5 apiTests 0x04010023 -[DatabaseManager managedObjectModel] + 291
6 apiTests 0x040102b7 -[DatabaseManager persistentStoreCoordinator] + 503
7 apiTests 0x0400f538 -[DatabaseManager setupContexts] + 312
@wilsolutions
wilsolutions / gist:1306098
Created October 22, 2011 15:16
warning: unused variable 'jsonFound1' [-Wunused-variable,12]
NSURL *apiURL = [NSURL URLWithString:@"http://api.stackoverflow.com/1.1/questions?tagged=objective-c&pagesize=30"];
NSError *error = nil;
// First option - failed
NSInputStream *inputStream = [NSInputStream inputStreamWithURL:apiURL]; // returning nil
id jsonFound1 = [NSJSONSerialization JSONObjectWithStream:inputStream options:NSJSONReadingMutableContainers error:&error];
@wilsolutions
wilsolutions / JSON NSLOG output
Created October 22, 2011 16:25
JSON NSLOG output
- (void)viewDidLoad
{
NSError *error = nil;
// Prepare URL request to JSON call...
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:
@"http://reviewapp/items.json"]];
NSData *response = [NSURLConnection
(function($) {
window.Insight = Backbone.Model.extend({
view: function(index) {
//return this.get('innovations')[index];
console.log(this.get('innovations')[index]);
}
});
@app = window.app ? {}
class Insight extends Backbone.Model
@app.Insight = Insight
class Insights extends Backbone.Collection
model: app.Insight
url: 'http://localhost/items.json'
initialize: ->
[
{
"Item":{
"id":"1",
"title":"Lightbulb Gadget - Self Plugging.",
"sub_title":"This guy plugs himself in. So, which came first? The socket or the plug?",
"description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero metus, suscipit vestibulum gravida vitae, ornare sit amet diam. Praesent et tincidunt metus. Etiam eu sapien turpis, id vehicula libero. In hendrerit congue leo sit amet mattis. Pr",
"rating_count":"3",
"created":"2011-10-19 10:49:07",
"modified":"2011-11-10 10:18:23"
Uncaught Error: Parse error on line 5:
... <hr /> XXX {{Rating[0].notes}}
---------------------^
Expecting 'ID'
{
"20131126080000": {
"page_views": 5,
"visits": 4,
"unique_visits": 2
},
"20131126080010": {
"page_views": 5,
"visits": 4,
"unique_visits": 2