View export-ble-infos.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View chunk_upload.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import requests | |
import uuid | |
from random import randint | |
from uuid import uuid4 | |
def read_in_chunks(file_object, chunk_size=65536): | |
while True: |
View dwr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
View consume.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
View upload.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" 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 | |
""" |
View gist:386af0fa667ae03daf3fbc80e3838ab0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
View smartos-on-a-budget.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
View read_only.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
View nbari.gpg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----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 |
View violetear-prometheus.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/subtle" | |
"fmt" | |
"log" | |
"net/http" | |
"time" | |
"github.com/nbari/violetear" |
NewerOlder