Skip to content

Instantly share code, notes, and snippets.

View zabirauf's full-sized avatar
👨‍💻
I may be slow to respond.

Zohaib Rauf zabirauf

👨‍💻
I may be slow to respond.
View GitHub Profile
@zabirauf
zabirauf / Prompting Techniques.ipynb
Created April 5, 2024 04:08
Evolution and Evaluation of prompt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zabirauf
zabirauf / claude_proxy_service.ts
Created March 19, 2024 15:02
Claude proxy service to support CORS
import { serve } from 'https://deno.land/std@0.154.0/http/server.ts';
const PORT = 8088;
const ALLOWED_HEADERS = ['x-api-key', 'anthropic-version', 'Content-Type'];
function addCORSHeaders(responseHeaders: Headers) {
responseHeaders.set('Access-Control-Allow-Origin', '*'); // Allow requests from any origin
responseHeaders.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); // Allowed methods
responseHeaders.set('Access-Control-Allow-Headers', '*'); // Allow all headers
}
async function anthropicReproducable(content: string): Promise<string> {
try {
let apiKey = 'Add API key'
const data = {
model: 'claude-3-sonnet-20240229',
system: "You are helpful assistant and your name it Le'Claude. Always add your name in response",
messages: [
{
role: 'user',
content: content,
@zabirauf
zabirauf / expng.ex
Created July 23, 2015 08:32
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@zabirauf
zabirauf / renew-mongo-cert.sh
Last active January 26, 2024 16:23
Renew certificate using certbot for MongoDB
#!/bin/bash
# Define variables
DOMAIN=foo.example.com
# renew cert
certbot renew
# combine latest letsencrypt files for mongo
@zabirauf
zabirauf / gopro-clip-mount.stl
Created January 8, 2023 23:59
GoPro mount that clips on one side and has the connector on other
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zabirauf
zabirauf / init.vim
Last active February 16, 2022 21:01
Neovim configuration
call plug#begin()
" Autocompletion
Plug 'roxma/nvim-completion-manager'
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --racer-completer --omnisharp-completer --tern-completer' }
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Buffer
@zabirauf
zabirauf / qc_for_cs_notebook.jl
Created January 10, 2021 06:43
Quantum computing for computer scientist - Julia notebook
### A Pluto.jl notebook ###
# v0.12.18
using Markdown
using InteractiveUtils
# ╔═╡ 72d474ec-4327-11eb-26d0-072a3be1e84f
begin
using Pkg
@zabirauf
zabirauf / qc_for_cs_notebook.html
Created January 10, 2021 06:06
Julia notebook for "Quantum computing for Computer scientist"
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" />
<title>⚡ Pluto.jl ⚡</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/editor.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/treeview.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.12.17/frontend/hide-ui.css" type="text/css" />
@zabirauf
zabirauf / ROP.ex
Created March 26, 2015 07:48
Railway Oriented Programming macros in Elixir
defmodule ROP do
defmacro try_catch(args, func) do
quote do
(fn ->
try do
unquote(args) |> unquote(func)
rescue
e -> {:error, e}
end