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
import os | |
import re | |
from email.mime.image import MIMEImage | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from smtplib import SMTP, SMTP_SSL, SMTPAuthenticationError, SMTPException | |
from urllib.parse import urlparse | |
import requests | |
from bs4 import BeautifulSoup | |
from jinja2 import Template |
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
timeout: 3600s | |
logsBucket: 'gs://$_CACHE_BUCKET' | |
options: | |
# machineType: 'E2_HIGHCPU_8' | |
steps: | |
- name: 'reactnativecommunity/react-native-android' | |
entrypoint: bash | |
args: | |
- -c |
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
import datetime | |
import json | |
import logging | |
import pickle | |
import sys | |
import timeit | |
from time import sleep | |
from django.conf import settings | |
from django.core.serializers.json import DjangoJSONEncoder |
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
""" | |
Node Depths: | |
The distance between a node in a Binary Tree and the tree's root is called the node's depth. | |
Write a function that takes in a Binary Tree and returns the sum of its nodes' depths. | |
Each BinaryTree node has an integer value, a left child node, and a right child node. | |
Children nodes can either be BinaryTree nodes themselves or None / null. | |
https://www.algoexpert.io/questions/Node%20Depths | |
""" | |
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
const jsonObj = {"doorsWindows":[{'ID':"A","style":"apple"},{'ID':"B","style":"apple"},{'ID':"C","style":"apple"}]} | |
const doorsWindowsIds = [] | |
for (var i = 0; i < jsonObj.doorsWindows.length; i++) { | |
let doorWindow = jsonObj.doorsWindows[i]; | |
doorsWindowsIds.push(doorWindow.ID) | |
} | |
console.log(doorsWindowsIds) |
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
""" | |
Reverse Linked List II: | |
Given the head of a singly linked list and two integers left and right where left <= right, | |
reverse the nodes of the list from position left to position right, and return the reversed list. | |
Follow up: Could you do it in one pass? | |
Example 1: | |
Input: head = [1,2,3,4,5], left = 2, right = 4 | |
Output: [1,4,3,2,5] |
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
image: openjdk:8-jdk | |
variables: | |
ANDROID_COMPILE_SDK: "29" | |
ANDROID_BUILD_TOOLS: "29.0.3" | |
SDK_TOOLS: "6200805" # from https://developer.android.com/studio/#command-tools | |
EMULATOR_VERSION: "24" | |
before_script: | |
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${SDK_TOOLS}_latest.zip |
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
#!/bin/bash | |
# Originally written by Ralf Kistner <ralf@embarkmobile.com>, but placed in the public domain | |
set +e | |
bootanim="" | |
failcounter=0 | |
timeout_in_sec=900 |
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
""" | |
Sometimes in your Django model you want to raise a ``ValidationError`` in the ``save`` method, for | |
some reason. | |
This exception is not managed by Django Rest Framework because it occurs after its validation | |
process. So at the end, you'll have a 500. | |
Correcting this is as simple as overriding the exception handler, by converting the Django | |
``ValidationError`` to a DRF one. | |
""" | |
from django.core.exceptions import ValidationError as DjangoValidationError |