Skip to content

Instantly share code, notes, and snippets.

View ahmednuaman's full-sized avatar
💭
I'm hiring! https://firemind.io/careers

Ahmed Nuaman ahmednuaman

💭
I'm hiring! https://firemind.io/careers
View GitHub Profile
{
content: [
{
source: {
data: imageData,
media_type: 'image/jpeg',
type: 'base64'
},
type: 'image'
},
@app.post("/api/invoke-prompt")
async def invoke_prompt(req: Request):
try:
body = await req.json()
return {
"response": await invoke_model_stream(
{
"messages": body["messages"],
"max_tokens": 3100,
const reader = new FileReader()
reader.onload = async (e) => loadPrompt(e.target.result)
reader.readAsArrayBuffer(file)
<Form.Control
accept='.jpg,.png'
multiple={true}
onChange={(e) => parseFiles(e.target.files).then(sendFiles)}
type='file'
/>
@ahmednuaman
ahmednuaman / dynamo-import.js
Created May 17, 2017 18:42
Serverless-dynamodb-local migration to AWS script
const { basename, join } = require('path')
const { DynamoDB } = require('aws-sdk')
const { readFileSync } = require('fs')
const glob = require('glob')
const doc = new DynamoDB.DocumentClient({
region: 'eu-west-2'
})
glob(join(process.cwd(), 'seed/db/*.json'), (error, files) => {
Verifying that +ahmednuaman is my blockchain ID. https://onename.com/ahmednuaman
@ahmednuaman
ahmednuaman / Dockerfile
Created October 16, 2015 11:13
Magento Dockerfile
FROM octohost/base:trusty
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys C300EE8C; \
echo 'deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main' > /etc/apt/sources.list.d/nginx-stable-trusty.list; \
apt-get update; \
apt-get install -y nginx git
ADD /tmp-conf/default /etc/nginx/sites-available/default
ADD /tmp-conf/nginx.conf /etc/nginx/nginx.conf
@ahmednuaman
ahmednuaman / Vagrantfile
Created May 22, 2015 18:52
LAMP on vagrant
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/vivid64"
config.vm.network "forwarded_port", guest: 80, host: 8000
config.vm.synced_folder ".", "/var/www/html"
config.ssh.forward_agent = true
config.vm.provision "shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
# Download and Install the Latest Updates for the OS
apt-get update && apt-get upgrade -y
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@ahmednuaman
ahmednuaman / gist:6156cad582db96a9099e
Created April 11, 2015 13:39
Cannot resolve module 'istanbul-instrumenter-loader'
var cwd = process.cwd(),
path = require('path');
module.exports = function (config) {
config.set({
basePath: cwd,
browsers: [
'Chrome'
],
files: [