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 img2pdf | |
from PIL import Image | |
def resize_image(img, max_resolution): | |
"""Resize image to the maximum resolution while maintaining the aspect ratio.""" | |
width, height = img.size | |
if max(width, height) > max_resolution: | |
scaling_factor = max_resolution / float(max(width, height)) | |
new_size = (int(width * scaling_factor), int(height * scaling_factor)) |
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 | |
CONFIG_FILE="/tmp/pg_script_config.tmp" | |
# Function to check if a command is available | |
command_exists() { | |
command -v "$1" >/dev/null 2>&1 | |
} | |
# Function to delete the config file |
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 json | |
class IntHash(): | |
""" | |
Creates a runtime integer from a given list of integer, strings. | |
""" | |
@classmethod |
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 the given dataframe add a column `result` with specifies whether a student | |
has passed or failed in their term. Any student is considered pass if all their scores are equal | |
or above 35 | |
""" | |
import numpy | |
import pandas | |
df = pandas.DataFrame([ | |
{ |
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
""" | |
Provide the definition of a function foo which returns the summation of | |
the given three integers when called as follows | |
""" | |
# Add function definition here | |
## Here result should be 12 |
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
""" | |
You are given with two lists, popular_products_ids and viewed_products_ids | |
- The first list is the list of ids of all popular products that any user would like to view | |
sorted on their popularity in descending order | |
- The second list is a list of ids of all products that this user has already viewed. | |
- Write a function get_fresh_products which return the products which are not yet viewed by | |
the user while maintaining the sorted order of popularity in an efficient manner | |
""" | |
popular_products_ids = list(map(id, range(50000))) |
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
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AFRAME = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | |
"use strict";module.exports={createLink:function(e,t){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("link");n.href=e,n.rel="stylesheet"; |