Skip to content

Instantly share code, notes, and snippets.

View aryamanarora's full-sized avatar
😮

Aryaman Arora aryamanarora

😮
View GitHub Profile
from transformers import AutoProcessor, BlipForConditionalGeneration
import requests
# load model
processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
model = model.to(device)
# tokenize the image + caption we're interested in
import csv, glob
from collections import Counter
lang = {}
for file in glob.glob('./*.txt'):
if 'task' in file: continue
with open(file, 'r') as fin:
reader = csv.reader(fin)
for i, row in enumerate(reader):
if i == 0: continue
@aryamanarora
aryamanarora / discord_chart.py
Created April 23, 2020 20:13
A chart for a Discord server's cumulative messages per user.
import csv
import matplotlib.pyplot as plt
from matplotlib import colors
from matplotlib.ticker import PercentFormatter
import matplotlib.dates as mdates
import datetime
from collections import Counter, defaultdict
import glob, os
hist = defaultdict(Counter)
import os
import numpy
import cv2
folder = input("Path to the folder where the videos are: ")
files = os.listdir(folder)
i = 0
n = len(files)
/*
12/3 (thanks to @i'm 2185 on CF):
(Silver)
Given two arrays of length n, A and B, find the A[i]th divisor of B[i] for each i.
1<=n, B[i]<=2*10^6
*/
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
@aryamanarora
aryamanarora / 32.asm
Created January 13, 2017 17:11 — forked from FiloSottile/32.asm
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@aryamanarora
aryamanarora / org-mode-reference-in.org
Created January 3, 2017 16:28 — forked from drj42/org-mode-reference-in.org
This is a cheat sheet for Emacs org-mode... in org-mode format!