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 / 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 / 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 / curry.ts
Created January 3, 2019 04:53
Strongly typed currying in Typescript
type Func = (...args: any[]) => any;
type FirstParam<T extends Func> =
T extends (arg: infer J, ...args: infer U) => infer V
? J
: never;
type TailParams<T extends Func> =
T extends (arg: infer J, ...args: infer U) => infer V
? U
@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
pragma solidity ^0.4.21;
import './GlobalCalculator.sol';
contract GlobalCalculator_V2 is GlobalCalculator_V1 {
function getMul() public view returns (uint mul) {
mul = 1;
for (uint i = 0;i < _nums.length; i++) {
mul *= _nums[i];
pragma solidity ^0.4.21;
contract GlobalCalculator_V1 {
uint[] internal _nums;
function addNum(uint x) public {
_nums.push(x);
}
function getSum() public view returns (uint sum) {