Skip to content

Instantly share code, notes, and snippets.

View Goddard's full-sized avatar
🎰
Coding

Ryein Goddard Goddard

🎰
Coding
View GitHub Profile
@Goddard
Goddard / staircase.py
Created April 15, 2019 20:43
hankerrank staircase example python
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the staircase function below.
def staircase(n):
@Goddard
Goddard / diagonalDifference.py
Created April 15, 2019 13:38
something I did for hankerrank
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the diagonalDifference function below.
def diagonalDifference(arr):
def draw_lines(img, lines, color=[255, 0, 0], thickness=10):
"""
NOTE: this is the function you might want to use as a starting point once you want to
average/extrapolate the line segments you detect to map out the full
extent of the lane (going from the result shown in raw-lines-example.mp4
to that shown in P1_example.mp4).
Think about things like separating line segments by their
slope ((y2-y1)/(x2-x1)) to decide which segments are part of the left
line vs. the right line. Then, you can average the position of each of
@Goddard
Goddard / install-node-npm-ubuntu-raring.sh
Created May 2, 2013 04:32 — forked from stephanetimmermans/gist:5496788
Install Node Js and NPM in Ubuntu 13.04
sudo apt-get install build-essential libssl-dev curl
# The install script
# Adapted from https://gist.github.com/579814
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/local/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
@Goddard
Goddard / helper.py
Created October 15, 2017 18:19
function from helper
def gen_test_video(sess, logits, keep_prob, input_image, clip, image_shape): #test_image
# image = scipy.misc.imresize(scipy.misc.imread(test_image), image_shape)
image = clip
im_softmax = sess.run(
[tf.nn.softmax(logits)],
{keep_prob: 1.0, input_image: [image]})
im_softmax = im_softmax[0][:, 1].reshape(image_shape[0], image_shape[1])
segmentation = (im_softmax > 0.5).reshape(image_shape[0], image_shape[1], 1)
mask = np.dot(segmentation, np.array([[0, 255, 0, 127]]))
@Goddard
Goddard / main.py
Created October 15, 2017 17:59
main network file for semantic segmentation
import os.path
import tensorflow as tf
import helper
import freeze
import warnings
from distutils.version import LooseVersion
import project_tests as tests
@Goddard
Goddard / video.py
Created October 15, 2017 17:15
Trying to use a pre-existing model and my additions after saving then restoring and run on video
import os.path
import tensorflow as tf
import helper
import cv2
from distutils.version import LooseVersion
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.format(tf.__version__)
print('TensorFlow Version: {}'.format(tf.__version__))
import numpy as np
import matplotlib.pyplot as plt
def graph(formula, x_range):
x = np.array(x_range)
y = formula(x)
plt.plot(x, y)
plt.show()
def my_formula(x):
@Goddard
Goddard / terminal-session
Created November 1, 2015 23:20 — forked from nlevchuk/terminal-session
It's bash script for saving and loading gnome-terminal session. Special for Ubuntu.
#!/bin/bash
##
## This is bash script for saving and loading gnome-terminal session. Special for Ubuntu.
##
## Usage: ./terminal-session -s <name_profile> - for save session
## ./terminal-session -l <name_profile> - for load existing session
## ./terminal-session --profiles - for show existing session files
##
## Instructions:
## - Run gnome-terminal;