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
| # Information about classes | |
| https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-classes-and-objects/cheatsheet | |
| # Information about pointers | |
| https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-references-and-pointers/cheatsheet |
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
| ### Document on to deal with Excel (.xlsx) files in Python | |
| # read-in Excel files into Pandas DF | |
| import pandas as pd | |
| DF = pd.read_excel('path/file.xlsx', 1) # 1 is the ix of the worksheet | |
| # we want to parse | |
| # concatenate different workbooks into a single workbook | |
| # ex extracted from : | |
| # https://towardsdatascience.com/merging-spreadsheets-with-python-append-f6de2d02e3f3 |
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 math | |
| try: | |
| print(math.sqrt(-9)) | |
| except ValueError: | |
| print("inf") | |
| else: | |
| print("fine") | |
| finally: | |
| print("the end") |
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
| #### Lambdas | |
| In Python, a lambda function is a single-line function declared with no name, which can have any number of arguments, but it can only have one expression. | |
| is a function without a name (you can also call it an anonymous function) | |
| # An example is a square function: | |
| # this is equivalent | |
| def square(num): | |
| return num * num |
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
| ##### SparkSQL | |
| from pyspark import SparkContext as sc | |
| from pyspark.sql import SparkSession | |
| spark1 = SparkSession.builder.appName('SQL').getOrCreate() | |
| # read-in a .csv file on stocks | |
| df = spark1.read.csv('appl_stock.csv',inferSchema=True,header=True) | |
| # print the schema of the readed 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
| # Tutorial at: | |
| https://towardsdatascience.com/scalable-python-code-with-pandas-udfs-a-data-science-application-dd515a628896 | |
| This tutorial shows how to apply a logistic Regression classifier in a distributes and parallelized mode to | |
| a Pandas dataframe that will be converted through Pandas UDF and the model will be map-applied |
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
| # background on Reverse Proxy | |
| https://www.middlewareinventory.com/blog/docker-reverse-proxy-example/#vuukle-emote | |
| # docker apache example with reversed proxy enabled. Tutorial I followed successfully | |
| https://www.middlewareinventory.com/blog/docker-reverse-proxy-example/ |
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
| ## ENUMS | |
| // An example program to demonstrate working | |
| // of enum in C | |
| #include<stdio.h> | |
| enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun}; | |
| int main() | |
| { |
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
| ## Reference documentation: | |
| https://docs.github.com/en/free-pro-team@latest/rest/guides/getting-started-with-the-rest-api | |
| # Basic curl get command: | |
| curl https://api.github.com/zen | |
| # The same but getting info on the headers: | |
| curl -i https://api.github.com/zen | |
| # Get info on a particular repo: |
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
| # Convert a time in UTC to BTC | |
| import pytz | |
| from datetime import datetime | |
| tz = pytz.timezone('UTC') | |
| naive_time = datetime.strptime('2016-04-05 15:00', '%Y-%m-%d %H:%M') | |
| tz_time = tz.localize(naive_time) | |
| london_tz = pytz.timezone('Europe/London') | |
| london_time = tz_time.astimezone(london_tz) | |
| print(tz_time) |