Skip to content

Instantly share code, notes, and snippets.

View nbari's full-sized avatar
🪴

nbari

🪴
View GitHub Profile
INFO: analyzing "profile.servers"
INFO: "servers": scanned 1 of 1 pages, containing 1 live rows and 9 dead rows; 1 rows in sample, 1 estimated total rows
INFO: analyzing "profile.samples"
INFO: "samples": scanned 1 of 1 pages, containing 8 live rows and 33 dead rows; 8 rows in sample, 8 estimated total rows
INFO: analyzing "profile.baselines"
INFO: "baselines": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO: analyzing "profile.bl_samples"
INFO: "bl_samples": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO: analyzing "profile.sample_stat_cluster"
INFO: "sample_stat_cluster": scanned 1 of 1 pages, containing 8 live rows and 33 dead rows; 8 rows in sample, 8 estimated total rows
@nbari
nbari / update.sh
Created August 18, 2023 13:07
update freebsd
#!/bin/sh
FREEBSD_VERSION=13
NUMBER_OF_CORES=`sysctl -n hw.ncpu`
ZPOOL="zroot"
START=$(date +%s)
if [ `sysctl -n kern.securelevel` -gt 0 ]; then
sysrc kern_securelevel_enable="NO"
echo "need to reboot with securelevel 0"
exit
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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"