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
python -m ipykernel install --user --name=jupyter2 | |
replace jupyter2 with the pyenv name | |
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
ack -l '(#{Analytics::Snippets::SANITIZED_AGENT_ROOM_LOGS})' | xargs perl -pi -E 's/(#{Analytics::Snippets::SANITIZED_AGENT_ROOM_LOGS})/#{Analytics::Snippets::SANITIZED_AGENT_ROOM_LOGS_REDSHIFT}/g' |
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
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath("sentiment_bootstrap_data.py")))) |
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
# Delete branches that have been merged | |
function cleanup-branches { | |
git checkout master;comm -12 <(git branch | sed "s/ *//g") <(git remote prune origin --dry-run | sed "s/^.*origin\///g") |xargs git branch -D | |
} |
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 pyspark.sql.types import StringType | |
from pyspark.sql.functions import udf | |
maturity_udf = udf(lambda age: "adult" if age >=18 else "child", StringType()) | |
df = sqlContext.createDataFrame([{'name': 'Alice', 'age': 1}]) | |
df.withColumn("maturity", maturity_udf(df.age)) |
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
for i in range(1,13): | |
sample_0_color = cv2.imread('./images/source/online/{}.tif'.format(i)) | |
channels_0 = blue, green, red = np.rollaxis(sample_0_color, 2) | |
sample_0_color = np.dstack((red, green, blue)) | |
small = cv2.resize(sample_0_color, (0,0), fx=0.15, fy=0.15) | |
plt.imsave('./images/source/online/{}.jpg'.format(i), small) |
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
I just found a great line to resize images from terminal in mac | |
`sips -Z 640 *.jpg` The -Z is to maintain aspect ratio 640 is the max width/height |
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
--ltv for users to call | |
with most_recent_subscription as ( | |
select | |
user_id, | |
max(created_at) as created_at | |
from subscriptions s | |
group by 1 | |
), | |
weekly_minutes as ( |
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
with summary as ( | |
select | |
identity_email, | |
identity_name, | |
company_industry, | |
company_domain, | |
company_name, | |
known_by_user_count, | |
identity_created_at, | |
identity_imported_from, |
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
-- TRAINING --- | |
with messager_message_and_webpage as ( | |
select | |
mm.identity_id, | |
s.created_at as sub_start_date, | |
-- If the identity has subscribed, what emails did we send to them beforehand? | |
count(distinct case when mm.messager_message_created_at <= coalesce(s.created_at - '1 day'::interval, getdate() - '3 months'::interval) then mm.messager_message_id else null end) as number_of_emails_sent, | |
sum(case when mm.messager_message_created_at <= coalesce(s.created_at - '1 day'::interval, getdate() - '3 months'::interval) and mm.email_outbound_link_opened_at is not null then 1 else null end) as number_of_emails_clicked, | |
sum(case when mm.messager_message_created_at <= coalesce(s.created_at - '1 day'::interval, getdate() - '3 months'::interval) and mm.email_outbound_sendgrid_first_open_at is not null then 1 else null end) as number_of_emails_opened, | |
sum(case when mm.messager_message_created_at <= coalesce(s.created_at - '1 day'::interval, getdate() - '3 months'::interval) and mm.user_replied_to_m |
OlderNewer