This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SOURCE=$1 | |
if [ -z "$SOURCE" ]; then | |
echo "I need the source directory" | |
exit | |
fi | |
if [ ! -d "$SOURCE" ]; then | |
echo "You did not give me a directory" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
usage(){ | |
cat << EOF | |
usage: $0 options | |
message me, send text message to a phone | |
PLEASE have an ssh key, cause otherwise this makes | |
no sense! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DIR_NAME="/home/nicolas/phone-sync/" | |
IFS=$'\n' | |
function main() { | |
DIR_KEY=$(mtp-folders | grep "sync" | sed 's/\([0-9]\+\)\s.*/\1/g') | |
loadLocalFiles | |
loadPhoneFiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from bs4 import BeautifulSoup | |
import pycurl | |
from io import BytesIO | |
import re | |
import sys | |
END = "abcdefghijklmnopqrstuvwxyz0123456789" | |
BB_URL = "http://www.bodybuilding.com/exercises/list/index/selected/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FibCoder: | |
''' | |
https://en.wikipedia.org/wiki/Fibonacci_coding | |
''' | |
def __init__(self, seed: int = 2): | |
self._fib = [] | |
self._fibonacci(seed) | |
def _next_fib(self, n: int): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
from matplotlib import pyplot as plt | |
def before_after(bef, af): | |
""" | |
refactor out the matplot lib thing | |
""" | |
plt.subplot(121), plt.imshow(bef, 'gray') | |
plt.subplot(122), plt.imshow(af, 'gray') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
def get_img(cap): | |
ret, frame = cap.read() | |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
return frame | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import matplotlib.pyplot as plt | |
kernel = (7, 7) | |
imgs = { | |
"salt_n_pepper": cv2.imread("Noise_salt_and_pepper.png"), # thank you wikipedia | |
"wrinkles": cv2.imread("old_man.jpeg"), # images.pexels.com | |
"tripod": cv2.imread("tripod.png") # classic b/w man looking at camera on tripod | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
def dog(img, k2=(7, 7), k1=(3, 3), denoise=False, denoise_k=3): | |
blur1 = cv2.GaussianBlur(img, k1, 1) | |
blur2 = cv2.GaussianBlur(img, k2, 1) | |
diff = blur1 - blur2 | |
if denoise: | |
diff = cv2.medianBlur(diff, denoise_k) | |
return diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
""" | |
Starting motivation [https://docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html] | |
RGB has no concept of hue unlike HS* (in this case we will do HSV). While we can extract it, it's not as straightforward | |
as with HSV. In our image, let's say we want to find the green parts. In HSV, we can do a pretty good job by just with | |
just an arc in the hue and then a fixed saturation range and value. Green can only exist in ~[90,150] degrees. Given |
OlderNewer