Skip to content

Instantly share code, notes, and snippets.

View fangpsh's full-sized avatar
🌴
On vacation

fangpsh fangpsh

🌴
On vacation
View GitHub Profile
@fangpsh
fangpsh / dynamic_quality.py
Created June 8, 2017 04:36 — forked from thebostik/dynamic_quality.py
Python Dynamic Image Quality Example
import cStringIO
import PIL.Image
from ssim import compute_ssim
def get_ssim_at_quality(photo, quality):
"""Return the ssim for this JPEG image saved at the specified quality"""
ssim_photo = cStringIO.StringIO()
# optimize is omitted here as it doesn't affect
# quality but requires additional memory and cpu
@fangpsh
fangpsh / otp
Created June 14, 2021 01:44 — forked from wr0ngway/otp
#!/bin/bash
# brew install oath-toolkit
#
# ~/.otpkeys:
# name1=secret
# name2=secret
scriptname=`basename $0`
if [ -z $1 ]