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
@liviaerxin
liviaerxin / README.md
Last active May 2, 2024 00:04
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@hursh-desai
hursh-desai / agent.py
Created January 13, 2023 10:17
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-********'
@kilianplapp
kilianplapp / scrape.py
Created November 29, 2022 20:21
Scrape 50 most recent pastes on PasteBin.com
import requests
from lxml import html
def getPastes():
for link in html.fromstring(requests.get("https://pastebin.com/archive").text).xpath('//tr//a'):
if str(link.get('href')).startswith('/archive/'): continue
yield (str(link.get('href')).replace('/', ''))
for i in getPastes():
print(i)
@vpnwall-services
vpnwall-services / curl-hack-.md
Created September 2, 2022 16:15
[CURL HACK] Curl Hack #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.

@Aditya1001001
Aditya1001001 / build_train_doc2vec.py
Last active April 19, 2023 15:34
Comparing Text Similarity Measures & Text Embedding Methods
def tagged_document(list_of_list_of_words):
for i, list_of_words in enumerate(list_of_list_of_words):
yield gensim.models.doc2vec.TaggedDocument(list_of_words, [i])
training_data = list(tagged_document(data))
model = gensim.models.doc2vec.Doc2Vec(vector_size=40, min_count=2, epochs=30)
model.build_vocab(training_data)
model.train(training_data, total_examples=model.corpus_count, epochs=model.epochs)

Everything You Need To Become A Machine Learner

Part 1:


Everything You Need To Become A Machine Learner

Part 1:

@prof3ssorSt3v3
prof3ssorSt3v3 / README.md
Last active January 24, 2023 07:18
Code from Getting Started with WebPack 5 (2021) video

File Details

  • webpack.config.js goes in the root folder of your project
  • package.json goes in the root folder of your project

Run this command to install all the dependecies from the package.json file

npm install
@alanjones2
alanjones2 / app.py
Last active February 2, 2023 11:43
Web visualization using Flask and Plotly
from flask import Flask, render_template
import pandas as pd
import json
import plotly
import plotly.express as px
app = Flask(__name__)
@app.route('/')
def index():
@devamitranjan
devamitranjan / UCB.py
Last active July 30, 2022 14:07
Upper Confidence Bound Implementation
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
class UpperConfidenceBound:
def __init__(self,path, N, m):
self.__dataset = pd.read_csv(path)
self.__N = N
self.__m = m
@oofnikj
oofnikj / answerfile
Last active April 26, 2024 17:13
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"