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 / error.txt
Created February 11, 2013 16:50
PHP crypto error read out
<br />
<font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: file_get_contents() [&lt;a href='function.file-get-contents'&gt;function.file-get-contents&lt;/a&gt;]: SSL: crypto enabling timeout in file.php on line <i>32</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0051</td><td bgcolor='#eeeeec' align='right'>647480</td><td bgcolor='#eeeeec'>{main}( )</td><td title='file.php' bgcolor='#eeeeec'>../file.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' a
@ahmednuaman
ahmednuaman / animateCSS.js
Created December 7, 2011 14:38
jQuery plugin to dynamically apply animate.css animations
(function ($) {
$.fn.animateCSS = function (effect, delay, callback) {
// Return this to maintain chainability
return this.each(function () {
// Cache $(this) for speed
var $this = $(this);
@ahmednuaman
ahmednuaman / wordpress-multisite-lighttpd.conf
Created December 12, 2010 21:52
A nice little rewrite directive for WordPress Multi-site and Lighttpd
url.rewrite-once = (
"^/(.*/)?files/$" => "/index.php",
"^/(.*/)?files/(.*)" => "/wp-content/blogs.php?file=$2",
"^(/wp-admin/.*)" => "$1",
"^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
"^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
"^/(.*)/?$" => "/index.php"
)
@ahmednuaman
ahmednuaman / update-wordpress.sh
Created December 1, 2010 11:13
A simple bash script to update Wordpress
#!/bin/bash
# This work is licenced under the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.
# To view a copy of this licence, visit http://creativecommons.org/licenses/by-sa/2.0/uk/ or send a letter
# to Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
# So before you start, the script assumes the following:
# 1. you have some sort of SSH access
# 2. you are owner of your blog (in terms of computa permissions)
# 3. the blog folder is called 'blog' (if not, change all instances of the word 'blog' with whatever it's called)
@ahmednuaman
ahmednuaman / remove-v-from-git-tags.sh
Created June 25, 2014 11:54
Remove the v from git tags
for tag in $(git tag)
do
git tag "${tag/v/}" $tag
done
for tag in $(git tag)
do
if [[ $tag = *v* ]]
then
git tag -d $tag
@ahmednuaman
ahmednuaman / subl3.json
Last active August 30, 2017 09:58
Sublimetext 3 prefs
{
"auto_complete": true,
"binary_file_patterns":
[
".nyc_*",
"dist/*",
"node_modules/*",
"bower_components/*",
"build/*",
"report/*",