Skip to content

Instantly share code, notes, and snippets.

# USAGE
# python detect_blur.py --images images
# import the necessary packages
from imutils import paths
import argparse
import cv2
def variance_of_laplacian(image):
# compute the Laplacian of the image and then return the focus
@ssbozy
ssbozy / CircularBuffer.py
Created December 1, 2017 15:18
Circular Buffer
class CircularBuffer(object):
def __init__(self, buffersize):
self.buffer = []
self.buffersize = buffersize
self.capacity = len(self.buffer)
def __repr__(self):
return '<CircularBuffer({0})>'.format(self.buffer)
@ssbozy
ssbozy / flashtext_regex_timing_keyword_replace.py
Created November 25, 2017 18:52 — forked from vi3k6i5/flashtext_regex_timing_keyword_replace.py
Benchmarking timing performance Keyword Replace between regex and flashtext
#!/bin/python
from flashtext.keyword import KeywordProcessor
import random
import string
import re
import time
def get_word_of_length(str_length):
# generate a random word of given length

#To hide notification icon

* launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
* killall NotificationCenter

#To show notification icon

* launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
* Hit Command+Shift+G and go to /System/Library/CoreServices/ 
* find “Notification Center” and double-click it to launch it again
#This little script takes into consideration a cooling rate and creates a new value for the ratings as time progresses
from datetime import datetime
import time
COOLINGRATE = 0.2
def fetch_new_rating(rating, timestamp):
diff_time = time.time() - timestamp
new_ratings = current_rating * exp(-cooling_rate * diff_time)
vagrant box list | awk '{print $1}' | uniq | xargs -I {} vagrant box remove {} --all
@ssbozy
ssbozy / keybase.md
Created June 6, 2017 06:22
keybase

Keybase proof

I hereby claim:

  • I am ssbozy on github.
  • I am ssbozy (https://keybase.io/ssbozy) on keybase.
  • I have a public key whose fingerprint is A0C4 02C6 2156 7F30 38EB 3563 17EB 2BD1 058E 4E96

To claim this, I am signing this object:

@ssbozy
ssbozy / safarireadinglistexport.sh
Created October 6, 2016 21:43
Safari Reading list export
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@ssbozy
ssbozy / posthaven.css
Created December 10, 2015 06:21
CSS for Posthaven
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300);
#header h1 a
{
font-family: 'Open Sans', sans-serif !important;
font-weight: 300 !important;
}
.post-title h2 a
{
font-family: 'Open Sans', sans-serif !important;
from tornado import httpserver, web, ioloop, options, log
from random import random
class BaseHandler(web.RequestHandler):
'''BaseHandler for all handlers'''
def write_error(self, status_code, **kwargs):
if status_code == 400:
response = {"code":status_code, "message": "Bad Request"}