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
export VENV_HOME=~/.venvs | |
export VENV_PYTHON=/usr/bin/python3 | |
fn_workon() { | |
if [ -f "${VENV_HOME}/${1}/bin/activate" ]; then | |
export VENV_CURRENT="${VENV_HOME}/${1}" | |
# Run commands before activation | |
if [ -f "${VENV_CURRENT}/pre_activate.sh" ]; then | |
. "${VENV_CURRENT}/pre_activate.sh" | |
fi |
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
# how to write do-while loop (kind of) | |
# starts with regular while loop | |
while True: | |
# call your function here | |
stuff() | |
if fail_condition: | |
# if fail condition met | |
# exit from while loop | |
break |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
0 | |
0 | |
1 | |
0 | |
0 | |
0 | |
1 | |
0 | |
1 | |
0 |
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
FROM python:2.7 | |
RUN apt-get update && apt-get install -y wget unzip build-essential cmake git libgtk2.0-dev pkg-config \ | |
libavcodec-dev libavformat-dev libswscale-dev \ | |
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ | |
libjasper-dev libdc1394-22-dev && pip install numpy && mkdir -p ~/opencv && cd ~/opencv && wget https://github.com/opencv/opencv/archive/3.4.1.zip && \ | |
unzip 3.4.1.zip && cd opencv-3.4.1 && mkdir build && cd build && \ | |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D PYTHON_EXECUTABLE=/usr/local/bin/python \ |
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 numpy as np | |
from numpy.lib.stride_tricks import as_strided | |
def strided_convolution(image, weight, stride): | |
im_h, im_w = image.shape | |
f_h, f_w = weight.shape | |
out_shape = (1 + (im_h - f_h) // stride, 1 + (im_w - f_w) // stride, f_h, f_w) | |
out_strides = (image.strides[0] * stride, image.strides[1] * stride, image.strides[0], image.strides[1]) |
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
#!/bin/bash | |
mkdir -p bin | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php -r "if (hash_file('SHA384', 'composer-setup.php') === '61069fe8c6436a4468d0371454cf38a812e451a14ab1691543f25a9627b97ff96d8753d92a00654c21e2212a5ae1ff36') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
php composer-setup.php --install-dir=bin --filename=composer | |
rm composer-setup.php |
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 caffe | |
import argparse | |
def show_net_info(net): | |
print '\n' | |
print 'layer output shape' | |
for layer_name, blob in net.blobs.iteritems(): | |
print layer_name + '\t' + str(blob.data.shape) |
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 sys import argv | |
from draw_matches import drawMatches | |
def main(image1_file, image2_file): | |
# load images | |
image1 = cv2.imread(image1_file, 0) | |
image2 = cv2.imread(image2_file, 0) |
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 python | |
import caffe | |
from caffe.proto import caffe_pb2 | |
from google.protobuf import text_format | |
class structtype: | |
pass | |
def loadSolver(fn): | |
with open(fn) as f: |
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
# change the hardstatus settings to give an window list at the bottom of the | |
# screen, with the time and date and with the current window highlighted | |
hardstatus alwayslastline | |
hardstatus string '%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{G}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %{G}%H %{g} %{B} %d/%m %{W}%c %{g}]' | |
# fix the altscren | |
altscreen on | |
defscrollback 10000 |
NewerOlder