Skip to content

Instantly share code, notes, and snippets.

@gentunian
gentunian / gist:ae26a4cee2ff3d8000b4
Created October 6, 2014 19:15
Multiline filter for logstash?
multiline {
pattern => "^\d"
what => "previous"
negate => true
}
@gentunian
gentunian / RecipesController.php
Last active August 29, 2015 14:16
Testing REST cakephp3
<?php
namespace App\Controller;
use Cake\Controller\Controller;
class RecipesController extends AppController
{
public function initialize()
@gentunian
gentunian / gist:f5ae1854f24cc9b86e7b
Created March 16, 2015 17:50
logstash-forwarder join
{
"paths": [ "/a/path" ],
"fields": { "type": "a_type" },
"join": [
{
"not": "^\\d{4}-\\d{2}-\\d{2}",
"with": "previous"
}
]
}
@gentunian
gentunian / command line
Last active August 29, 2015 14:22
collection.findOne() bug?
meteor create testFindOne
cd testFindOne
meteor mongo
# insert some data
db.users.insert({id:1, profilePicture: 'test1.png'});
db.users.insert({id:2, profilePicture: 'test1.png'});
# exit mongo
meteor
open: http://127.0.0.1:3000
< var t = new Mongo.Collection(null);
> undefined
< t.insert({ble: 1})
> "EvZXebTK3HdhJPNCY"
< t.insert({ble: 2})
> "GfeBhBptZxYruApqo"
< t.insert({ble: 4})
> "gmg8kPEWzyiC2hBys"
< var c = t.find();
> undefined
@gentunian
gentunian / gist:82517b92c2e76cf4b26c
Last active August 29, 2015 14:24
some code example
Template.sessionDialog.onRendered(function() {
$('#myModal').on('hidden.bs.modal', function (e) {
Blaze.remove(Blaze.getView($('#myModal').get(0)));
})
});
Template.loggedin.events({
"click #showCreateSessionDialog": function (e, tmpl) {
Blaze.renderWithData(Template.sessionDialog,
activedirectorylogin {
com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule sufficient
debug="true"
contextFactory="com.sun.jndi.ldap.LdapCtxFactory"
providerUrl="ldap://mydomain.com:389"
bindDn="<bind-user>"
bindPassword="<bind-user-password>"
authenticationMethod="simple"
forceBindingLogin="true"
userBaseDn="<base-dc>"
@gentunian
gentunian / gist:cfb826d6ca49bd3d9e38
Created August 7, 2015 15:35
mongodb aggregation
{ "_id" : ObjectId("55c4cad542d5abb845ee68ab"), "date" : "1", "type" : "C" }
{ "_id" : ObjectId("55c4cad642d5abb845ee68ac"), "date" : "1", "type" : "C" }
{ "_id" : ObjectId("55c4cad842d5abb845ee68ad"), "date" : "1", "type" : "C" }
{ "_id" : ObjectId("55c4cadc42d5abb845ee68ae"), "date" : "1", "type" : "A" }
{ "_id" : ObjectId("55c4cadc42d5abb845ee68af"), "date" : "1", "type" : "A" }
{ "_id" : ObjectId("55c4cade42d5abb845ee68b0"), "date" : "1", "type" : "B" }
{ "_id" : ObjectId("55c4cae142d5abb845ee68b1"), "date" : "2", "type" : "B" }
{ "_id" : ObjectId("55c4cae242d5abb845ee68b2"), "date" : "2", "type" : "B" }
{ "_id" : ObjectId("55c4cae442d5abb845ee68b3"), "date" : "2", "type" : "A" }
{ "_id" : ObjectId("55c4cae542d5abb845ee68b4"), "date" : "2", "type" : "C" }
{{#autoForm ... }}
...
{{> afQuickField name="createdBy" }}
...
{{/autoForm}}
@gentunian
gentunian / selector.js
Last active August 29, 2015 14:27
tabular server-side selector
selector: function( userId ) {
var roleNames = _.pluck(Roles.find({users: {$in: [userId]}}, {fields: {name: 1, _id: 0}}).fetch(), 'name');
var users = [];
var query;
if (_.contains(roleNames, 'manager')) {
// this wrapping is just for keeping the code readable
query = Meteor.users.find({}, { fields: {_id: 1 }, transform: function (doc) { doc.users = doc._id; return doc;}});
// or:
// query = { users: [ userId ] };
} else if (_.contains(roleNames, 'admin')) {