Skip to content

Instantly share code, notes, and snippets.

View SamWhited's full-sized avatar

Sam Whited SamWhited

View GitHub Profile
@SamWhited
SamWhited / rawextract.py
Last active March 28, 2023 07:49
Extract metadata from Canon CR2 and Nikon NEF raw files
#!/usr/bin/env python
import sys
import os
from rawphoto.cr2 import Cr2
from rawphoto.nef import Nef
def print_entries(raw, ifd, level=1):
for name in ifd.entries:
@SamWhited
SamWhited / ejabberd.yml
Last active November 17, 2022 12:44
Example ejabberd config
### =======
### LOGGING
##
## loglevel: Verbosity of log files generated by ejabberd.
## 0: No ejabberd log at all (not recommended)
## 1: Critical
## 2: Error
## 3: Warning
## 4: Info
source env/bin/activate; python -m photoshell
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
@SamWhited
SamWhited / gist:aaf1ff4353de9f06a502
Created December 18, 2014 18:37
Test ejabberd SSL ciphers with openssl
#!/bin/bash
CIPHERS=`grep ^s2s_ciphers /etc/ejabberd/ejabberd.yml | cut -d\" -f2 | sed 's,:,\n,g'`
for CIPHER in $CIPHERS; do
echo "Testing: ${CIPHER}..."
openssl s_client -connect samwhited.com:5269 -starttls xmpp -cipher ${CIPHER} || echo "Fail"
done
@SamWhited
SamWhited / TimePreference.java
Created December 17, 2014 00:10
Time picker preference for Android
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TimePicker;
import java.text.DateFormat;
import java.util.Calendar;
@SamWhited
SamWhited / pubkeys.md
Last active July 18, 2017 02:16
Public Keys [NO LONGER UP TO DATE]

This gist is deprecated; some of the keys may still be used, but the fingerprints are no longer mirrored to two or more locations for verification.

PGP

9761 51DE E472 01CE 4A85 9F70 5408 3AE1 04EA 7AD3

Verification methods

@SamWhited
SamWhited / rendermontage.sh
Created October 20, 2014 18:40
Script to render a montage of many images with an overlay
#!/bin/sh
#
# Requires: ImageMagick
# Usage:
# rendermontage.sh thumbsize overlayimage outputimage
#
montage -geometry $1x$1>+0+0 *.{jpeg,jpg,png} $3
composite -gravity center -background none $2 $3 $3
@SamWhited
SamWhited / lincolnletter.tex
Created October 14, 2014 14:14
Open letter to the city council of Lincoln
\documentclass{letter}
\signature{Sam Whited}
\address{Atlanta, GA}
\begin{document}
\begin{letter}{Lincoln Town Office \\ PO Box 25 \\ Lincoln, NH 03251}
\opening{To whom it may concern:}
@SamWhited
SamWhited / spec.md
Last active August 29, 2015 14:05
API spec for a simple, universal commenting system

Simple comments API 1.0.0-draft01

Copyright

This work is licensed under a [Creative Commons Attribution 4.0 International License][ccby].

Introduction

@SamWhited
SamWhited / README.md
Last active August 29, 2015 13:58
A simple server that accepts HTTP post requests

This is a simple server example that accepts geojson features as POST requests (fair warning, it does no validation to make sure anything is geojson conformant) and spits out a geojson file with all the features wrapped in a feature array.

This is just an example. It does lots of bad things (like reading / writing the entire file every time it gets a post request) and is easily abused. The authentication isn't exactly secure either. By default it listens on :2230.