Skip to content

Instantly share code, notes, and snippets.

View bitsnaps's full-sized avatar
🌍
Working @ CorpoSense

Ibrahim H. bitsnaps

🌍
Working @ CorpoSense
View GitHub Profile
@bitsnaps
bitsnaps / .block
Created May 12, 2024 11:41 — forked from domoritz/.block
Vega Bl.ocks example
license: bsd-3-clause
@bitsnaps
bitsnaps / finetune_llama_v2.py
Created April 16, 2024 18:01 — forked from younesbelkada/finetune_llama_v2.py
Fine tune Llama v2 models on Guanaco Dataset
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@bitsnaps
bitsnaps / OAI_CONFIG_LIST
Created January 7, 2024 18:28 — forked from langecrew/OAI_CONFIG_LIST
Taking the Autogen Teachable Agent one step further with some customization
[
{
"model": "gpt-4",
"api_key": "PASTE_YOUR_API_KEY_HERE"
},
{
"model": "gpt-4-1106-preview",
"api_key": "PASTE_YOUR_API_KEY_HERE"
},
{
@bitsnaps
bitsnaps / gptq_lora.py
Created December 19, 2023 18:35 — forked from datasciencemonkey/gptq_lora.py
train a gptq model using peft/lora
# %%
# this is run from /notebooks on paperspace
from huggingface_hub import login
from dotenv import load_dotenv
load_dotenv("/notebooks/.env")
import os
os.environ["TOKENIZERS_PARALLELISM"]="false"
login(token=os.getenv("HUGGINGFACE_TOKEN"))
1. Install oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
2. Clone necessary plugins.
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. Add plugins to ~/.zshrc as
plugins = ( [plugins...] zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting)
from flask import Flask, jsonify, request
import requests
import PyPDF2
import tempfile
import pickle
import retrying
from langchain.llms import OpenAI
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
from langchain.docstore.document import Document
from langchain.embeddings.openai import OpenAIEmbeddings
@bitsnaps
bitsnaps / agent.py
Created June 21, 2023 09:56 — forked from hursh-desai/agent.py
obsidian + langchain
import os
import re
import faiss
from langchain import FAISS
import obsidiantools.api as otools
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.chains.qa_with_sources import load_qa_with_sources_chain
from langchain.llms import OpenAI
os.environ["OPENAI_API_KEY"] = 'sk-********'
@bitsnaps
bitsnaps / curl-hack-.md
Last active March 13, 2023 08:32 — forked from vpnwall-services/curl-hack-.md
Curl example #bash #curl #hack

Hacking With cURL

A list of examples and references of hacking with Bash and the Curl command.

What the heck is cURL?

cURL is short for "Client URL" and is a computer software project providing a library (libcurl) and command-line tool (curl) first released in 1997. It is a free client-side URL transfer library that supports the following protocols: Cookies, DICT, FTP, FTPS, Gopher, HTTP/1, HTTP/2, HTTP POST, HTTP PUT, HTTP proxy tunneling, HTTPS, IMAP, Kerberos, LDAP, POP3, RTSP, SCP, and SMTP Although attack proxies like BurpSuitePro are very handy tools, cURL allows you to get a bit closer to the protocol level, leverage bash scripting and provides a bit more flexibility when you are working on a complex vulnerability.

cURL GET parameters

HTTP GET variables can be set by adding them to the URL.

@bitsnaps
bitsnaps / bypass_ssl_insecurities.py
Created February 26, 2023 18:04 — forked from sujit/bypass_ssl_insecurities.py
Selenium Bypass SSL Bad/Revoked Certificates
import sys
from time import sleep
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import WebDriverException
from eliot import start_action, to_file, log_call
# from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support import expected_conditions as EC
@bitsnaps
bitsnaps / JScienceTest.groovy
Created September 25, 2022 22:04 — forked from kimukou/JScienceTest.groovy
JScienceTest.groovy
// reference http://www.geocities.jp/tomtomf/JScience/JScience.htm
//
@GrabResolver (name='jcurl-repository', root='http://jcurl.berlios.de/m2/repo/')
@Grab(group = 'org.jscience', module='jscience', version='4.3.1')
import org.jscience.mathematics.number.Complex
import org.jscience.mathematics.vector.ComplexMatrix
//計算結果の出力様関数
def show(cm) {