Skip to content

Instantly share code, notes, and snippets.

@danielgross
danielgross / mathpix2gpt.py
Last active July 11, 2024 15:11
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()
@huytung228
huytung228 / mean_avg_precision.py
Created August 15, 2021 05:09
Calculate mAP object detection
import torch
from collections import Counter
from iou import intersection_over_union
def mean_average_precision(
pred_boxes, true_boxes, iou_threshold=0.5, box_format="midpoint", num_classes=20
):
"""
Calculates mean average precision
@discdiver
discdiver / jupyterlab_shortcuts.md
Last active September 20, 2024 18:39
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cell or cells - if no cells below, insert a code cell below

  • Ctrl + B toggle hide/show left sidebar

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as

@bespokoid
bespokoid / SpaceVim.md
Last active September 2, 2024 15:09
SpaceVim cheatsheet #tools
@killertilapia
killertilapia / python_csv.py
Last active December 16, 2021 03:20
Reading and Writing CSV Files in Python
"""
Assuming our CSV file (employee_birthday.csv) has the contents of
name,department,birthday month
John Smith,Accounting,November
Erica Meyers,IT,March
"""
# Reading CSV Files with csv
@dcbark01
dcbark01 / install.sh
Created April 22, 2019 20:59
Automated install of Anaconda3 on AWS EC2 and setup of AWS CLI/Boto3
#!/usr/bin/env bash
# ---------------------------- INSTALL NOTES ----------------------------
# To properly setup the AWS CLI, make sure that this shell script is run with the two required positional args:
# $1 :: (string) AWS Access Key ID
# $2 :: (string) AWS Secret Key
#
# Also make sure to give the script permission to run!:
# chmod 755 /home/ec2-user/install.sh
#
@mshRoR
mshRoR / django2.1-python3.7-pipenv-installing-command.txt
Last active May 13, 2020 07:38
python 3.7 | pip3 | pipenv | django 2.1 installing commands in ubuntu 16.04
## python 3.7 install
-> sudo apt update
-> sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
-> sudo apt install software-properties-common
-> sudo add-apt-repository ppa:deadsnakes/ppa
-> sudo apt update
-> sudo apt install python3.7
-> python3.7 --version
## pip3 install
@AruniRC
AruniRC / ms_coco_classnames.txt
Created March 5, 2018 20:37
Class Names of MS-COCO classes in order of Detectron dict
{0: u'__background__',
1: u'person',
2: u'bicycle',
3: u'car',
4: u'motorcycle',
5: u'airplane',
6: u'bus',
7: u'train',
8: u'truck',
9: u'boat',
@xigang
xigang / sort_time.go
Created May 4, 2017 04:04
Sorting by time.Time in Golang
package main
import (
"fmt"
"sort"
"time"
)
type reviews_data struct {
review_id string
@terencezl
terencezl / convert_pdf.py
Created April 20, 2017 04:39
use pdfminer to extract pdf
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter, XMLConverter, HTMLConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from io import BytesIO
def convert_pdf(path, format='text', codec='utf-8', password=''):
rsrcmgr = PDFResourceManager()
retstr = BytesIO()
laparams = LAParams()