Skip to content

Instantly share code, notes, and snippets.

@duhaime
duhaime / measure_img_similarity.py
Last active March 1, 2023 08:41
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@dvm-shlee
dvm-shlee / pykoen.py
Last active April 21, 2022 10:19
pykoen, jupyter notebook 을 이용한 interactive 한영번역기 (구글번역기 + Ginger 문법교정기)
from __future__ import absolute_import
import json
import sys
import re
import requests
import urllib
import urlparse
from urllib2 import HTTPError
from urllib2 import URLError
from urllib2 import urlopen
@allanlewis
allanlewis / pytest_newline_before_output.py
Last active October 19, 2018 19:25
A Pytest fixture that prints a newline before any other output when running with `-s` (`--capture=no`)
@pytest.yield_fixture(autouse=True)
def newline_before_logging(request):
if request.config.getoption('capture') == 'no':
print() # new-line
yield
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ccstone
ccstone / References For Learning & Using Applescript.md
Last active June 12, 2024 01:23
References For Learning & Using Applescript

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

@iMilnb
iMilnb / ec2.py
Created May 27, 2015 12:29
AWS EC2 simple manipulation script using python and boto3
#!/usr/bin/env python
# Simple [boto3](https://github.com/boto/boto3) based EC2 manipulation tool
#
# To start an instance, create a yaml file with the following format:
#
# frankfurt:
# - subnet-azb:
# - type: t2.micro
# image: image-tagname
import time
class PageCategoryFilter(object):
def __init__(self, config):
self.mode = config["mode"]
self.categories = config["categories"]
def filter(self, bid_request):
if self.mode == "whitelist":
--- appicon.py 2015-01-23 02:21:33.000000000 +0900
+++ appicon2.py 2015-01-23 02:47:26.000000000 +0900
@@ -4,6 +4,7 @@
import os
import sys
from wand.image import Image
+from wand.exceptions import BlobError, CoderError, MissingDelegateError
DIMENSIONS = {
'OSX': [
@allieus
allieus / app_icon_creator.py
Last active September 22, 2015 17:55
OSX/iOS/Android 앱 아이콘 생성기
#!/usr/bin/env python2
# coding: utf-8
from __future__ import print_function
from tempfile import NamedTemporaryFile
import os
import sys
from shutil import copyfile
from wand.image import Image
DIMENSIONS = {
@bavernet
bavernet / ITES
Created December 22, 2014 11:35
q = [0] * 5000000
def solve(k, n):
ss = 0
cnt = 0
prev = 1983
front = 0
rear = 0
for i in xrange(n):
num = prev % 10000 + 1