Skip to content

Instantly share code, notes, and snippets.

View afifaniks's full-sized avatar

Afif Al Mamun afifaniks

View GitHub Profile
import csv
import time
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
P1 = """Please act as an expert Python software engineer.
Given the function below, generate a complete and professional Google-style docstring.
The docstring should not include any extra commentary, only
@afifaniks
afifaniks / ensf380_ia3_db.py
Created April 15, 2024 20:30
ENSF 380 - Winter 2024 IA3 DB Operations Automation
import psycopg2
from psycopg2 import OperationalError
def connect_to_database(dbname, user, password, host='localhost', port=5432):
conn = psycopg2.connect(
dbname=dbname,
user=user,
password=password,
host=host,
@afifaniks
afifaniks / greek_alphabet.csv
Created November 9, 2023 02:20
Greek Alphabet
Letter Uppercase Lowercase
Alpha Α α
Beta Β β
Gamma Γ γ
Delta Δ δ
Epsilon Ε ε
Zeta Ζ ζ
Eta Η η
Theta Θ θ
Iota Ι ι
@afifaniks
afifaniks / powershell_list_directory_with_size.ps
Created May 9, 2023 16:58
List Directories and Size in Powershell
$fso = new-object -com Scripting.FileSystemObject
gci -Directory `
| select @{l='Size'; e={$fso.GetFolder($_.FullName).Size}},FullName `
| sort Size -Descending `
| ft @{l='Size [MB]'; e={'{0:N2} ' -f ($_.Size / 1MB)}},FullName
@afifaniks
afifaniks / wsl_installer.ps
Created August 5, 2022 13:27
Install WSL on different drive
# Substitute the drive on which you
# want WSL to be installed if not D:
Set-Location D:
# Create a directory for WSL and change to it:
New-Item WSL -Type Directory
Set-Location .\WSL
# Install 22.04 from https://docs.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2204 -OutFile Linux.appx -UseBasicParsing
def parseWordDocument(String filePath) {
// Splitting filename from URL
def fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.size())
File file = null
if (Files.isReadable(Paths.get(fileName))){
println("[LOADING FROM CACHE]: " + filePath)
file = new File(fileName)
} else {
import java.util.Arrays;
import java.util.List;
/**
* Project: AdvancedJava
* Author: AFIF AL MAMUN
* Created in 10/12/20
* Web: https://afifaniks.me
*/
class DataHolderClass{
//Author: Afif
#include <bits/stdc++.h>
using namespace std;
int table[20][20]; char dir[20][20];
int main()
{
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t;
double arr[10], per[10];
@afifaniks
afifaniks / Post_Evaluation.c
Created March 20, 2017 17:38
Evaluating Postfix Expression with Stack
/*Afif
20 March, 2017
EVALUATING POSTFIX EXPRESSION WITH STACK
*/
#include <stdio.h>
#define SZ 50
int top=-1, stk[SZ];