This file contains hidden or 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 | |
set -x | |
set -e | |
{ | |
AWS_CONFIG_FILE=~/.aws/config | |
mkdir ~/.aws | |
touch $AWS_CONFIG_FILE | |
chmod 600 $AWS_CONFIG_FILE |
This file contains hidden or 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 unittest | |
class TestDumbClass(unittest.TestCase): | |
def setUp(self): | |
pass | |
def test_useless_assert(self): | |
self.assertEqual('1', '1') |
This file contains hidden or 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 flask import Flask | |
application = Flask(__name__) | |
@application.route('/') | |
def hello_world(): | |
return 'Hello, World!' | |
if __name__ == '__main__': | |
application.run(debug=True, port=8080) |
This file contains hidden or 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 os | |
import random | |
from scipy import ndarray | |
# image processing library | |
import skimage as sk | |
from skimage import transform | |
from skimage import util | |
from skimage import io |
This file contains hidden or 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
# define a name for our new file | |
new_file_path = '%s/augmented_image_%s.jpg' % (folder_path, num_generated_files) | |
# write image to the disk | |
sk.io.imsave(new_file_path, transformed_image) |
This file contains hidden or 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
# dictionary of the transformations functions we defined earlier | |
available_transformations = { | |
'rotate': random_rotation, | |
'noise': random_noise, | |
'horizontal_flip': horizontal_flip | |
} | |
# random num of transformations to apply | |
num_transformations_to_apply = random.randint(1, len(available_transformations)) |
This file contains hidden or 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 random | |
from scipy import ndarray | |
import skimage as sk | |
from skimage import transform | |
from skimage import util | |
def random_rotation(image_array: ndarray): | |
# pick a random degree of rotation between 25% on the left and 25% on the right | |
random_degree = random.uniform(-25, 25) | |
return sk.transform.rotate(image_array, random_degree) |
This file contains hidden or 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 random | |
import os | |
# our folder path containing some images | |
folder_path = 'images/cats' | |
# the number of file to generate | |
num_files_desired = 1000 | |
# loop on all files of the folder and build a list of files paths | |
images = [os.path.join(folder_path, f) for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))] |
This file contains hidden or 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 { Injectable } from '@angular/core'; | |
import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; | |
import * as moment from 'moment'; | |
@Injectable() | |
export class NgbDateMomentAdapter extends NgbDateAdapter<moment.Moment> { | |
fromModel(date: moment.Moment): NgbDateStruct { | |
if (!date) { | |
return null; |
This file contains hidden or 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
app.controller("AppCtrl", function($scope){ | |
var count = 0; | |
var timeout; | |
/* | |
* This function count each click. At the first click | |
* it create a timeout of 300 ms. | |
* If a second click is fire on this interval it will | |
* execute what we want on "double tap". |