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
#!/bin/bash | |
cp docker-compose.yml backup/ | |
cp get-docker.sh backup/ | |
cp uploads.ini backup/ | |
rsync -av --delete www/ backup/www/ | |
sudo rsync -av --delete /var/lib/docker/volumes/rocket_db_data/ backup/rocket_db_data/ |
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 pandas as pd | |
from sklearn.feature_extraction.text import CountVectorizer | |
text = [ | |
'Promptly answer to my request.', | |
'great turnaround time!', | |
'Fast response and great service!', | |
'As usual you took the request and completed in as few steps as possible and well done!', | |
'Very quick turnaround time and great communication. Thank you!', |
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
def fibonacci(): | |
current_value, next_value = 0, 1 | |
while True: | |
yield current_value | |
current_value, next_value = next_value, current_value + next_value | |
result = fibonacci() | |
for _ in range(10000000000000): | |
print(next(result)) |
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 pandas as pd | |
import seaborn as sns | |
titanic_df = pd.read_csv('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic3.csv') | |
titanic_df.head() | |
sns.countplot(x=titanic_df.survived, hue=titanic_df.sex) | |
sns.countplot(x=titanic_df.survived, hue=titanic_df.embarked) | |
sns.boxplot(x=titanic_df.survived, y=titanic_df.age) |
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 pandas as pd | |
from sklearn import cluster | |
data = { | |
'data': [2, 3, 4, 10, 12, 20, 30, 11, 25] | |
} | |
df = pd.DataFrame(data) | |
kmeans = cluster.KMeans(n_clusters=2) |
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/python | |
# | |
# More of a reference of using jinaj2 without actual template files. | |
# This is great for a simple output transformation to standard out. | |
# | |
# Of course you will need to "sudo pip install jinja2" first! | |
# | |
# I like to refer to the following to remember how to use jinja2 :) | |
# http://jinja.pocoo.org/docs/templates/ | |
# |
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 pytest | |
@pytest.mark.parametrize('test_input, expected', [ | |
(3, 'Fizz'), | |
(6, 'Fizz'), | |
(5, 'Buzz'), | |
(10, 'Buzz'), | |
(15, 'FizzBuzz'), | |
(30, 'FizzBuzz'), |
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 pytest | |
class FizzBuzz: | |
def say(self, number): | |
if number % 3 == 0 and number % 5 == 0: | |
return 'FizzBuzz' | |
elif number % 3 == 0: | |
return 'Fizz' | |
elif number % 5 == 0: |
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 pytest | |
class FizzBuzz: | |
def say(self, number): | |
if number % 3 == 0 and number % 5 == 0: | |
return 'FizzBuzz' | |
elif number % 3 == 0: | |
return 'Fizz' | |
elif number % 5 == 0: |
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 pytest | |
class FizzBuzz: | |
def say(self, number): | |
if number % 3 == 0 and number % 5 == 0: | |
return 'FizzBuzz' | |
elif number % 3 == 0: | |
return 'Fizz' | |
elif number % 5 == 0: |