Skip to content

Instantly share code, notes, and snippets.

View xlson's full-sized avatar

Leonard Gram xlson

View GitHub Profile
@xlson
xlson / grafana.ini
Created June 12, 2018 12:53
Modifying grafana.ini of a running docker container
[database]
log_queries = true
@xlson
xlson / Dockerfile
Created April 6, 2020 13:43
Dockerized Grafana on CentOS
ARG BASE_IMAGE=centos:8
FROM ${BASE_IMAGE} AS grafana-builder
ARG GRAFANA_TGZ="grafana-latest.linux-x64.tar.gz"
COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz
RUN mkdir /tmp/grafana && tar xfz /tmp/grafana.tar.gz --strip-components=1 -C /tmp/grafana
FROM ${BASE_IMAGE}
@xlson
xlson / groovycsv-example.groovy
Created April 14, 2011 12:20
Example of using GroovyCSV 0.2 to parse csv
@Grab('com.xlson.groovycsv:groovycsv:0.2')
import com.xlson.groovycsv.CsvParse
def csv = '''Name-Lastname
Mark-'Anderson-Nielsen'
Pete-Hansen'''
def data = new CsvParser().parse(csv, separator: '-', quoteChar: "'")
for(line in data) {
println "$line.Name $line.Lastname"
}
@xlson
xlson / grafana.ini
Last active March 7, 2018 08:51
Enables anonymous access for testing volume mapping with Docker and Grafana
##################### Grafana Configuration Example #####################
#
# Everything has defaults so you only need to uncomment things you want to
# change
# possible values : production, development
; app_mode = production
# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
; instance_name = ${HOSTNAME}
@xlson
xlson / ColumnFixesSpec.groovy
Created July 14, 2017 08:52
Example of removing blanks in columnNames
import spock.lang.Specification
class ColumnFixesSpec extends Specification {
def csvData = """Name,Last Name,Age
Leonard,Gram,33"""
def "Removing all blanks from columnNames to make them easier to parse"() {
setup:
def columnNames = CsvParser.parseCsv(csvData).next().columns.collect { it.key.toString().replaceAll(' ','') }
@xlson
xlson / updating-xml-with-XmlParser-and-NodeBuilder.groovy
Created March 19, 2010 08:41
Example of updating xml with Groovy using XmlParser and NodeBuilder.
def exampleXmlString = '''<?xml version="1.0" encoding="UTF-8"?>
<persons>
<person>
<name>John</name>
<lastname>Doe</lastname>
<age>38</age>
</person>
</persons>'''
def exampleXml = new XmlParser().parseText(exampleXmlString)
@xlson
xlson / indexer.conf
Created October 17, 2013 11:18
Logstash 1.2.1 config to reproduce the problem of logstash not shutting down properly after being sent ^C.
input {
redis {
host => "127.0.0.1"
data_type => "list"
key => "logstash"
codec => json
}
}
output {
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
sudo apt-get update
sudo apt-get upgrade
@xlson
xlson / gist:5335234
Created April 8, 2013 08:43
Emacs tips to me
delete-matching-lines (uses regexp)
C-x r k
Kill the text of the region-rectangle, saving its contents as the “last killed rectangle” (kill-rectangle).
@xlson
xlson / gist:3118133
Created July 15, 2012 18:47
The sweetest spam I've ever received
My name is mary As I whisper my prayer tonight and went into search for a nice friend at Google today and saw you
profile I came across your contact , My mind and my heart told me to contact you for friendship, A friend who truly
understand his or her friend and share their feelings together. please kindly accept my request, I believe that distance
or age can never be a barrier but let's love connect us because love is a bridge that connected far distance to be close
to each other, I will send more pictures to you immediately I receive your reply at my email address and i have
something in mind to tell you about my life.
PLEASE I WANT YOU TO CONTACT ME DIRECTLY TO ME EMAIL ADDRESS