Skip to content

Instantly share code, notes, and snippets.

View bpanahij's full-sized avatar

Brian P Johnson bpanahij

  • San Francisco, CA
View GitHub Profile
import os
import time
import urllib.parse
from abc import ABC, abstractmethod
from multiprocessing.synchronize import Event
from typing import Any, Mapping, Optional
import requests
from daily import (
CallClient,
import {Fragment, useState, useCallback, useEffect} from 'react';
import "maplibre-gl/dist/maplibre-gl.css";
import "@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css";
import {API, Geo, graphqlOperation, Storage} from 'aws-amplify';
import {searchOriginalImages} from "@/graphql/queries"
import ImageGrid from "@/components/ImageGrid";
import {Dialog, Transition} from "@headlessui/react";
import {XMarkIcon} from "@heroicons/react/24/outline";
import DroneCalibrator from "@/components/DroneCalibrator";
@bpanahij
bpanahij / convert_to_webp.sh
Last active October 25, 2023 18:49
Image Pre-processing Pipeline for my NextJS App
#!/bin/bash
# Set the directory to search for files in
dir="../assets/public/images/originals"
# Recursively loop through all JPG and PNG files in the directory
find "$dir" -type f \( -iname \*.jpg \) -print0 | while read -d $'\0' file; do
# Run the command on each file
convert "$file" -auto-orient "$file"
newfile="${file%.*}.webp"
#!/usr/bin/zsh
extract_metadata.sh
geocode_from_metadata.sh
#! /bin/bash
#07/06/18 A BASH script to collect EXIF metadata
#07/06/18 create metadata directory, create text file output for each file, append basename, place output in metadata directory
#07/06/18 create script.log to verify processing of files and place in metadata directory
#07/06/18 Author: Sandy Lynn Ortiz - Stanford University Libraries - Born Digital Forensics Lab
#08/21/18 TO RUN: Place the script in the working directory. The script will search sub-dir's.
# Open a terminal window (command prompt) and navigate to the working directory
# i.e. cd /path/to/directory. Type ./SAA.sh and hit enter.
# The script will take a few min to run (start with a small set of testing files), depending on the number of files.
# It will prompt you when it completes. Try different commands in place of EXIFTOOL per your need.
#!/usr/bin/zsh
count=0
zeroos="0000"
find $(cd "$CWD") -depth -iname "*.json" | while read filename;
do
neighborhood=$((jq ".[0].GPSLatitude" $filename && echo "," && jq ".[0].GPSLongitude" $filename) | tr -d '\n' | geocoder | jq .neighborhood | sed -re 's/"//g' -re 's/ /_/g')
datetime=$(jq ".[0].CreateDate" $filename | sed -re "s/\"([^:]*):([^:]*):([^ ]*).*/\1-\2-\3/")
echo "${neighborhood}_$datetime"
original_filepath=$(jq ".[0].SourceFile" $filename | sed -re 's/"//g')
@bpanahij
bpanahij / Moto
Last active November 28, 2015 04:21
Moto React
class Wheel extends React.Component {
constructor (props) {
super(props);
this.props.image = "https://s3.amazonaws.com/code_brian/react/Front+Wheel.png";
}
render() {
var styles = {
wheel: {
@bpanahij
bpanahij / index.html
Created November 28, 2015 04:09 — forked from anonymous/index.html
Reaction // source https://jsbin.com/jotanay
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://fb.me/react-with-addons-0.13.3.js"></script>
<meta charset="utf-8">
<title>Reaction</title>
<style id="jsbin-css">
@bpanahij
bpanahij / index.html
Created November 28, 2015 03:01 — forked from anonymous/index.html
Reaction // source https://jsbin.com/jotanay
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://fb.me/react-with-addons-0.13.3.js"></script>
<meta charset="utf-8">
<title>Reaction</title>
<style id="jsbin-css">

Keybase proof

I hereby claim:

  • I am bpanahij on github.
  • I am brianjohnson (https://keybase.io/brianjohnson) on keybase.
  • I have a public key whose fingerprint is EDC5 7472 F5B5 DA7A 9D74 0344 3A9E 0438 CC8F 8132

To claim this, I am signing this object: