Skip to content

Instantly share code, notes, and snippets.

View sjukkola's full-sized avatar

Samu Jukkola sjukkola

  • Helsinki, Finland
View GitHub Profile
/*
This problem was asked by Apple.
A fixed point in an array is an element whose value is equal to its index. Given a sorted array of distinct elements, return a fixed point, if one exists. Otherwise, return False.
For example, given [-6, 0, 2, 40], you should return 2. Given [1, 5, 7, 8], you should return False.
check these for better implementation
https://rosettacode.org/wiki/Binary_search#JavaScript
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@sjukkola
sjukkola / image-upload-to-aws.js
Last active July 16, 2023 17:31
Extract image from url and upload to AWS s3
const AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
const s3 = new AWS.S3();
const uuidV4 = require('uuid');
const request = require('request');
const s3Bucket = new AWS.S3( { params: { Bucket: 'samus-original-bucket' } } )
request.get({
method: 'GET',
url: 'http://lorempixel.com/400/200/',