Skip to content

Instantly share code, notes, and snippets.

🐣

Nicolas Embriz nbari

🐣
Block or report user

Report or block nbari

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
@nbari
nbari / upload.py
Last active Feb 17, 2020
add a file into a mysql BLOB column
View upload.py
""" Example for adding a file into a blob
CREATE TABLE test (
id INT AUTO_INCREMENT,
data LONGBLOB NOT NULL,
PRIMARY KEY (id)
);
pip install --upgrade --user mysqlclient
"""
@nbari
nbari / smartos-on-a-budget.sh
Created Nov 3, 2019 — forked from jahewson/smartos-on-a-budget.sh
Installing and Configuring SmartOS on a budget server (with a /29)
View smartos-on-a-budget.sh
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##################################################################
Installing and Configuring SmartOS on a budget server (with a /29)
##################################################################
# if you find this gist useful, please star it
# please be aware that budget hosting companies usually cut corners somewhere,
@nbari
nbari / read_only.js
Created Mar 5, 2019
couchdb read-only _design/read_only
View read_only.js
function(newDoc, oldDoc, userCtx, secObj) {
var ddoc = this;
secObj.admins = secObj.admins || {};
secObj.admins.names = secObj.admins.names || [];
secObj.admins.roles = secObj.admins.roles || [];
var IS_DB_ADMIN = false;
if(~ userCtx.roles.indexOf("_admin"))
IS_DB_ADMIN = true;
if(~ secObj.admins.names.indexOf(userCtx.name))
IS_DB_ADMIN = true;
@nbari
nbari / nbari.gpg
Created Aug 13, 2018
pgp public key
View nbari.gpg
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFdcWLYBEACtY37dvmeb1bmPvPObd+XpwA5/B00LokDqPXRpcCpznIhMNIQQ
KTzThNOm73qSuP4vweu0fS6rndf4hEukKG420RXQHFsj/4TFdTFtNcVr4eTXDFn3
LNlYod0QeEdoL3EjKDx03XeMAin/Zrg8kiGHW3zOvsu3DkpnDJZbMqcwKSWcx4E0
WzUVlh2oQFF8QIWQjCY+sTAWXuCLZtjIPrlgBPTfa1tZjNDGZHvma29ioGcmTxbM
6nyfP45h2BLPnjCrKo/s/rKPBS8fl7A1X/LQ4ljQmj6W+n/BIL9o5ufy6KNYOfKW
HFif/JRx/C8dE8StCbSiRcuBJlFyMG8q8lMFmHwSnn/T27nnQN4uQV2sBiOjMXO6
NWXMRvHZRPj1gnvDtIbSMqCIU8s87sHNTeUBoM49UKdVsfZ34nd2I+h19cS0OQDg
yQSsKoXtW/LSnngEX7SKgeO/M2n6iMcGKdpl7WOSLlSBIgFQSOJcSC8mMs54Dk1D
@nbari
nbari / violetear-prometheus.go
Last active Jan 3, 2018
violetear + prometheus
View violetear-prometheus.go
package main
import (
"crypto/subtle"
"fmt"
"log"
"net/http"
"time"
"github.com/nbari/violetear"
@nbari
nbari / syslog-ng
Created Nov 27, 2017
syslog-ng 2 elasticsearch
View syslog-ng
# 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 Nov 11, 2017
immortal start-stop-daemon script (/etc/init.d/immortaldir)
View 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 Sep 16, 2017
find git remotes
View remotes.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
@nbari
nbari / restart-elk.yml
Created Aug 22, 2017
ansible rolling restart elasticsearch node
View restart-elk.yml
# 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 Mar 17, 2017
define variable within makefile rule
View makefile
.PHONY: all test clean
GLOBAL="spirituosen"
all:
@echo ${GLOBAL}
test:
$(eval GLOBAL="trinken")
@echo ${GLOBAL}
You can’t perform that action at this time.