Skip to content

Instantly share code, notes, and snippets.

View nbari's full-sized avatar
🪴

nbari

🪴
View GitHub Profile
@nbari
nbari / syslog-ng
Created November 27, 2017 15:36
syslog-ng 2 elasticsearch
# This file is managed by Puppet. DO NOT EDIT.
# This file was generated by Puppet's ihrwein-syslog_ng module
@version: 3.8
@module mod-java
@include "scl.conf"
options {
chain_hostnames(yes);
keep_hostname(no);
log_fifo_size(1000);
normalize_hostnames(yes);
@nbari
nbari / immortaldir
Created November 11, 2017 19:43
immortal start-stop-daemon script (/etc/init.d/immortaldir)
#!/bin/sh
# immortaldir start-stop-daemon
set -e
NAME=immortaldir
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/immortaldir
DAEMON_OPTS="/etc/immortal"
@nbari
nbari / remotes.go
Last active September 16, 2017 11:51
find git remotes
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
@nbari
nbari / restart-elk.yml
Created August 22, 2017 16:14
ansible rolling restart elasticsearch node
# Elasticsearch Rolling restart using Ansible
#
# Perform a rolling restart of the elasticsearch nodes and wait for the cluster
# to stabilize before continuing processing nodes.
#
# The handlers are chained together using notify to perform the following process:
#
# 1. Disable shard allocation on the cluster
# 2. Restart the elasticsearch node process
# 3. Wait for the node to rejoin the cluster
@nbari
nbari / makefile
Created March 17, 2017 09:55
define variable within makefile rule
.PHONY: all test clean
GLOBAL="spirituosen"
all:
@echo ${GLOBAL}
test:
$(eval GLOBAL="trinken")
@echo ${GLOBAL}
@nbari
nbari / errorHandler.go
Created March 12, 2017 18:29
violetear prototype for a centralized HTTP error handling
package main
import (
"fmt"
"log"
"net/http"
"time"
v "github.com/nbari/violetear"
)
@nbari
nbari / http2Push.go
Created February 18, 2017 11:21
HTTP/2 Push example
// HTTP/2 Push example using violetear
//
// Create certificate with:
// https://golang.org/src/crypto/tls/generate_cert.go
// go run generate_cert.go -host localhost,127.0.0.1 (will create cer.pem and key.pem)
//
// To test
// go run main.go and open browser using https://localhost:8000
package main

Keybase proof

I hereby claim:

  • I am nbari on github.
  • I am nbari (https://keybase.io/nbari) on keybase.
  • I have a public key whose fingerprint is 38A2 1ADF 535C 36C3 9EF0 320F 4480 2F8C 91F6 6E10

To claim this, I am signing this object:

@nbari
nbari / scraper.py
Created October 27, 2016 19:36
web scraper
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://search.cro.ie/company/CompanySearch.aspx")
inputElement = driver.find_element_by_id("ctl00_ContentPlaceHolder1_textCompanyName")
inputElement.send_keys("limo")
inputElement.send_keys(Keys.ENTER)
links = driver.find_elements_by_xpath("//*[@id='ctl00_ContentPlaceHolder1_GridView1']/tbody/tr/td/a")
@nbari
nbari / gist:386af0fa667ae03daf3fbc80e3838ab0
Created July 2, 2016 07:56 — forked from juanqui/gist:7564275
Golang Kqueue Snippet
// helpful links:
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/EV_SET.2.html
// http://julipedia.meroh.net/2004/10/example-of-kqueue.html
// create kqueue
kq, err := syscall.Kqueue()
if err != nil {
log.Println("Error creating Kqueue descriptor!")
return
}