Skip to content

Instantly share code, notes, and snippets.

@jayant91089
jayant91089 / leetcode-bloomberg.md
Last active April 15, 2024 14:25
Answers to leetcode questions tagged 'Bloomberg'

121 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.

If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.

Example 1: Input: [7, 1, 5, 3, 6, 4] Output: 5

@devdrops
devdrops / example.md
Last active March 25, 2024 15:09
Mysqldump from Docker container

Mysqldump from Docker container

docker exec -i mysql_container mysqldump -uroot -proot --databases database_name --skip-comments > /path/to/my/dump.sql

OBS

  • This will generate a dump.sql file in your host machine. Awesome, eh?
  • Avoid using --compact on your dump. This will make MySQL check your constraints which will cause troubles when reading your file (damm you MySQL). And don't use --force to fix this scenario: recreate your dump without --compact ¯_(ツ)_/¯
@carnal0wnage
carnal0wnage / python_email.py
Created June 21, 2016 16:47 — forked from srv89/python_email.py
Python code for sending HTML email (Attachment + Multiple Recipients )
__author__ = 'srv'
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
username = '' # Email Address from the email you want to send an email
password = '' # Password
server = smtplib.SMTP('')