Skip to content

Instantly share code, notes, and snippets.

View rudibroekhuizen's full-sized avatar
🎯
Focusing

Rudi Broekhuizen rudibroekhuizen

🎯
Focusing
View GitHub Profile
@rudibroekhuizen
rudibroekhuizen / gist:fea8b99fb689903b1d36
Created February 13, 2015 09:22
Logstash WMI input
# Author: rudi.broekhuizen@naturalis.nl
#
# C:/Temp/metrics.ps1:
# Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq "C:" } | Select-Object SystemName, Caption, FreeSpace | convertto-json -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8
# Get-WmiObject Win32_OperatingSystem | convertto-json -Depth 1 -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8
# Get-WmiObject Win32_PerfFormattedData_PerfOS_System | convertto-json -Depth 1 -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8
#
input {
exec {
command => "@powershell -NoProfile -ExecutionPolicy unrestricted -File C:/Temp/metrics.ps1"
@rudibroekhuizen
rudibroekhuizen / openstack.grok
Last active December 7, 2015 09:06
Logstash GROK patterns for OpenStack syslogs
# Logstash GROK patterns for OpenStack syslogs
DNSMASQ_DHCP %{WORD:dhcp_action}%{TAP_DEVICE}%{SPACE}%{IPV4:dhcp_client_ip}%{SPACE}%{COMMONMAC:dhcp_client_mac}
TAP_DEVICE (\(%{GREEDYDATA:tap_device})\)
OPENSTACK_PROGRAM (^fuel$|^horizon_access$|^nova-api$|^neutron-server$|^cinder-api$|^heat-engine$|^nailgun-agent$|^mcollective$|^glance-api$|^nova-compute$|^heat-api$|^heat-api-cfn$|^dnsmasq-dhcp$|^ocf-ns_haproxy$|^murano-api$|^haproxy$|^ceph-osd$|^ceph-mon$)
OPENSTACK_USER [0-9A-Za-z]{32}
<?php
$hostname = 'localhost';
$username = 'root';
$password = 'mypass';
$database = 'mysql';
$sql = 'select * from general_log';
//open connection to mysql db
$connection = mysqli_connect($hostname,$username,$password,$database) or die("Error " . mysqli_error($connection));
#!/usr/bin/env python3
import asyncio
import asyncpg
#DB_CONFIG = {
# 'host': 'localhost',
# 'user': 'drupal_user',
# 'password': 'password',
# 'port': 5432,
@rudibroekhuizen
rudibroekhuizen / .spacevim
Last active June 2, 2020 09:12
space-vim config file (liuchengxu/space-vim)
" You can enable the existing layers in space-vim and
" exclude the partial plugins in a certain layer.
" The command Layer is vaild in the function Layers().
" Use exclude option if you don't want the full Layer,
" e.g., Layer 'better-defaults', { 'exclude': 'itchyny/vim-cursorword' }
function! Layers()
" Default layers, recommended!
Layer 'fzf'
Layer 'unite'
--
-- Here comes some general advise on how to use HyperLogLog
-- for someone who wants to implement a YouTube-like service
-- using the awesome https://github.com/citusdata/postgresql-hll PostgreSQL extension
--
CREATE TABLE counter (
id text NOT NULL,
sketch hll NOT NULL DEFAULT hll_empty(),
PRIMARY KEY (id)