Skip to content

Instantly share code, notes, and snippets.

View nbari's full-sized avatar
🪴

nbari

🪴
View GitHub Profile
@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 / 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 / violetear-prometheus.go
Last active January 3, 2018 15:21
violetear + prometheus
package main
import (
"crypto/subtle"
"fmt"
"log"
"net/http"
"time"
"github.com/nbari/violetear"
@nbari
nbari / nbari.gpg
Created August 13, 2018 19:47
pgp public key
-----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 / read_only.js
Created March 5, 2019 16:02
couchdb read-only _design/read_only
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 / smartos-on-a-budget.sh
Created November 3, 2019 09:34 — forked from jahewson/smartos-on-a-budget.sh
Installing and Configuring SmartOS on a budget server (with a /29)
# 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 / upload.py
Last active February 17, 2020 20:03
add a file into a mysql BLOB column
""" 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 / consume.rs
Created August 16, 2020 21:08
how to use traits
use futures::stream::TryStreamExt;
use ring::digest::{Context, SHA256};
use std::error::Error;
use std::fmt::Write;
use std::time::Instant;
use tokio::fs::File;
use tokio::io::AsyncBufRead;
use tokio::io::BufReader;
// use tokio::prelude::*;
use tokio_util::codec::{BytesCodec, FramedRead};
@nbari
nbari / dwr
Created March 23, 2022 10:05
delete git workflows
#!/usr/bin/env bash
# Delete workflow runs - dwr
# Given an "owner/repo" name, such as "qmacro/thinking-aloud",
# retrieve the workflow runs for that repo and present them in a
# list. Selected runs will be deleted. Uses the GitHub API.
# Requires gh (GitHub CLI) and jq (JSON processor)
@nbari
nbari / export-ble-infos.py
Created December 18, 2022 13:35 — forked from Mygod/export-ble-infos.py
Export your Windows Bluetooth LE keys into Linux!
#!/usr/bin/python3
"""
Copyright 2021 Mygod
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0