Skip to content

Instantly share code, notes, and snippets.

View AllardQuek's full-sized avatar
🏠

Allard AllardQuek

🏠
View GitHub Profile
@AllardQuek
AllardQuek / settings.json
Created September 3, 2021 13:27
VS Code Sample settings.json
{
"python.pythonPath": "/Users/allard/anaconda3/envs/ml/bin/python",
"terminal.integrated.inheritEnv": false,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.jediEnabled": false,
// "python.languageServer": "Microsoft",
"vsicons.dontShowNewVersionMessage": true,
"liveServer.settings.donotShowInfoMsg": true,
"files.exclude": {
@AllardQuek
AllardQuek / function.py
Last active July 11, 2021 18:15
Run SageMaker notebook from AWS Lambda
import boto3
import time
from botocore.vendored import requests
from websocket_client import websocket
def lambda_handler(event, context):
sm_client = boto3.client('sagemaker')
notebook_instance_name = 'automate-nb'
url = sm_client.create_presigned_notebook_instance_url(NotebookInstanceName=notebook_instance_name)['AuthorizedUrl']
import React from "react";
import "react-dropzone-uploader/dist/styles.css";
import Dropzone from "react-dropzone-uploader";
const Uploader = () => {
const axios = require("axios").default;
const API_ENDPOINT = <<YOUR_API_ENDPOINT>>
const handleChangeStatus = ({ meta, remove }, status) => {
console.log(status, meta);
const AWS = require('aws-sdk')
AWS.config.update({ region: process.env.AWS_REGION })
const s3 = new AWS.S3()
const uploadBucket = 'test-bucket-357' // Replace this value with your bucket name!
const URL_EXPIRATION_SECONDS = 30000 // Specify how long the pre-signed URL will be valid for
// Main Lambda entry point
exports.handler = async (event) => {
return await getUploadURL(event)
}
@AllardQuek
AllardQuek / dictionary.c
Last active December 31, 2018 16:39
CS50 Pset5 Speller: dictionary.c
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h> //for malloc!
#include <ctype.h>
#include <string.h>
#include "dictionary.h"
// defining global variables