Skip to content

Instantly share code, notes, and snippets.

@jeffbryner
jeffbryner / delegated_credential.py
Created December 17, 2023 21:57
google delegated creds from a gcp service account
def delegated_credential(credentials, subject, scopes):
from google.auth import iam
from google.auth.transport import requests
from google.oauth2 import service_account
TOKEN_URI = "https://accounts.google.com/o/oauth2/token"
try:
admin_creds = credentials.with_subject(subject).with_scopes(scopes)
except AttributeError: # Looks like a compute creds object
# Refresh the boostrap credentials. This ensures that the information
@jeffbryner
jeffbryner / fix_missing_exif.py
Created November 24, 2022 18:40
Add missing exif date from filename
# small script to add exif date tags to photos that are missing them
# assumes the date is in the filename in the format: <something>-DATE-anythingelse.<jpg|png|etc>
# and that the date can be parsed by dateutil.parser
# dependencies
# pip install exif, python-dateutil
import exif
import glob
from exif import Image
@jeffbryner
jeffbryner / Dockerfile
Created November 22, 2021 22:42
cloudbuild with local docker builder
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
cat .inputrc
"\e[5~": history-search-backward
"\e[6~": history-search-forward
@jeffbryner
jeffbryner / pd_threshold.py
Created October 18, 2019 18:24
pandas threshold function
def pd_threshold(in_dict,column_name,threshold_count):
'''given a dictionary (or data frame), return a dictionary of the column values over a certain threshold'''
df=pd.DataFrame(in_dict)
df_count=df.groupby(column_name)[column_name].count()
return df_count[df_count.where(df_count>threshold_count)>threshold_count].to_dict()

Keybase proof

I hereby claim:

  • I am jeffbryner on github.
  • I am 0x7eff (https://keybase.io/0x7eff) on keybase.
  • I have a public key ASC1HuFOZoQ-lVt-4CZ2rozOACHs2rJbmX2DmfiuJ1SNVgo

To claim this, I am signing this object:

@jeffbryner
jeffbryner / Dockerfile
Created July 9, 2018 16:22
mozdef_meteor dockerfile
FROM centos:7
LABEL maintainer="[email protected]"
ENV NODE_VERSION 4.7.0
ENV METEOR_VERSION 1.4.2.3
ENV MONGO_URL=mongodb://mongodb:3002/meteor
ENV ROOT_URL=http://localhost
ENV PORT=3000
@jeffbryner
jeffbryner / docker-compose.yml
Created July 9, 2018 16:20
docker compose for local meteor development.
---
version: '2.2'
services:
mongodb:
build: mongodb/
restart: always
command: /usr/bin/mongod --smallfiles --config /etc/mongod.conf
volumes:
- mongodb:/var/lib/mongo
ports:
magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3&dn=BreachCompilation&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fglotorrents.pw%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337
@jeffbryner
jeffbryner / gist:afa9c468a571533d66cf5e907c4d1e71
Created December 18, 2016 23:02
create docker image of a meteor UI (mozdef)
#build mozdefUI
#rm all previous docker containers/images
docker ps -a
<list>
docker rm <imageid>
docker images
<list>
docker rmi $(docker images -qf "dangling=true")