Skip to content

Instantly share code, notes, and snippets.

View ThrowsException's full-sized avatar

Chester O'Neill ThrowsException

View GitHub Profile
use bcrypt::{DEFAULT_COST, hash_with_salt};
use hex::encode;
use sha2::{Digest, Sha512};
fn main() {
println!("Hello, world!");
let my_string = "LSlIhPLWw1j1UjZFG/bJde";
// let mut my: [u8; 16] = my_string[0..16].try_into().unwrap()
let my: [u8; 16] = my_string[0..16].as_bytes().try_into().unwrap();
@ThrowsException
ThrowsException / release-branch-tag.sh
Created April 14, 2022 23:46
Find branches matching a pattern and tag them
IFS=$'\n'
for b in $(git for-each-ref --format='%(objectname) %(refname:lstrip=-1)' 'refs/remotes/origin/RELEASE-2021*' 'refs/remotes/origin/RELEASE-2020*' 'refs/remotes/origin/RELEASE-2019*' --count=1); do
sha=$(echo "$b" | cut -d' ' -f1)
branch=$(echo "$b" | cut -d' ' -f2)
echo "$sha"
echo "$branch"
git tag "$branch" "$sha"
done
@ThrowsException
ThrowsException / app.py
Created March 18, 2019 02:25
PBX device state
import urllib.request
# create a password manager
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and password.
# If we knew the realm, we could use it instead of None.
top_level_url = "http://192.168.1.218:8088/ari/"
password_mgr.add_password(None, top_level_url, "testuser", "password")

Keybase proof

I hereby claim:

  • I am throwsexception on github.
  • I am coneill (https://keybase.io/coneill) on keybase.
  • I have a public key ASAvDAimMByDbTBGSsDemUqO9zHm_sjStsA8lRaA1W4HLQo

To claim this, I am signing this object:

@ThrowsException
ThrowsException / celery_mongo.py
Created August 26, 2015 21:52
Simple celery app with mongodb
from celery import Celery
CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
app = Celery('tasks', broker=CELERY_BROKER_URL)
app.conf.update(
CELERY_TASK_SERIALIZER='json',
CELERY_ACCEPT_CONTENT=['json'],
CELERY_RESULT_SERIALIZER='json',
CELERY_MONGODB_SCHEDULER_DB = "celery",
CELERY_MONGODB_SCHEDULER_COLLECTION = "schedules",
def create_app(config_settings=None):
app = Flask(__name__)
file_handler = RotatingFileHandler('app.log')
file_handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'
))
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)