Skip to content

Instantly share code, notes, and snippets.

View fa-ahmad's full-sized avatar
👨‍💻

Farhan Ahmad fa-ahmad

👨‍💻
View GitHub Profile
@olegdulin
olegdulin / 00_helloWorld.py
Created April 16, 2016 11:23
Write a "Hello World" into an AWS CloudWatch Logs service
#!/usr/local/bin/python3
import boto3
import time
logs = boto3.client('logs')
LOG_GROUP='TUTORIAL-DEV2'
LOG_STREAM='stream1'
@fa-ahmad
fa-ahmad / crash.py
Created June 6, 2019 04:47
Stack Trace
TypeError Traceback (most recent call last)
<ipython-input-44-a553646a889c> in <module>
22 for i, samples in enumerate([samples_1, samples_10, samples_100]):
23 results[clf_name][i] = \
---> 24 train_predict(clf, samples, X_train, y_train, X_test, y_test)
25
26 # Run metrics visualization for the three supervised learning models chosen
<ipython-input-36-2fd67492e721> in train_predict(learner, sample_size, X_train, y_train, X_test, y_test)
19 # TODO: Fit the learner to the training data using slicing with ‘sample_size’ using .fit(training_features[:], training_labels[:])
@fa-ahmad
fa-ahmad / ipython-sql.md
Last active February 11, 2022 10:25
Capture output of SQL command with Ipython/Jupyter Notebook

The indirection operator captures the output of any SQL query into a Python variable. In the example below the variable output will contain the result of the query. The query used here is irrelevant and only used for illustrating the usage.

%%sql output << 
SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS data_type, a.attnotnull, i.indisprimary
FROM   pg_index i
JOIN   pg_attribute a ON a.attrelid = i.indrelid
 AND a.attnum = ANY(i.indkey)