Skip to content

Instantly share code, notes, and snippets.

View armsp's full-sized avatar
👋

Shantam Raj armsp

👋
View GitHub Profile
@ahoho
ahoho / prompt_alpaca_lora.py
Last active May 7, 2024 04:28
Create a huggingface pipeline with a lora-trained alpaca
from typing import Optional, Any
import torch
from transformers.utils import is_accelerate_available, is_bitsandbytes_available
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
GenerationConfig,
pipeline,
@siayi
siayi / Quickly extract tar gz files Windows 10.md
Last active August 16, 2023 19:28
Quickly extract .tar.gz files on Windows 10

Extract .tar.gz, .tgz, or .gz tarballs using tar on Windows 10

To extract .tar.gz, .tgz, .gz as well as .zip files using tar on Windows 10, use these steps:

  1. Open Start on Windows 10.
  2. Search for Command Prompt, right-click the first result and select the Run as administrator option.
  3. Type the following command to use tar to extract the files and press Enter:
tar -xvzf C:\PATH\TO\FILE\FILE-NAME.tar.gz -C C:\PATH\TO\FOLDER\EXTRACTION
@armsp
armsp / Class_File_Upload.py
Last active June 11, 2020 08:20
Upload files to flask restful server in two different ways. First is a proper upload and the other copies file from a given location to server's location by only providing the file path of file to copy in the URL itself.
import os
from flask import Flask, Response, request, jsonify, redirect, send_from_directory
from flask_restful import Api, Resource
from werkzeug.utils import secure_filename
class file_operation:
def __init__(self):
self.APP_ROOT = os.path.dirname(os.path.abspath(__file__))
self.UPLOAD_FOLDER = os.path.join(self.APP_ROOT, 'upload_folder_logreg')
self.ALLOWED_EXTENSIONS = set(['txt', 'csv'])
@OndraZizka
OndraZizka / switchHeadphones.sh
Last active March 25, 2024 12:58
Bluetooth headset - switch between quality sound + no mic (A2DP) and crappy sound and mic (HSP/HFP)
#!/bin/bash
#### Restart Bluetooth
if [ "$1" == "resetBT" ] ; then
sudo rfkill block bluetooth && sleep 0.1 && sudo rfkill unblock bluetooth;
exit;
fi;
#### Toggle listen/speak
if [ "$1" == "" -o "$1" == "toggle" ] ; then
@armsp
armsp / doublyLinkedList.c
Last active May 9, 2018 18:16
Doubly linked list implemented in C without any global variables.
#include <stdio.h>
#include <stdlib.h>
#include "doublyLinkedList.h"
Node* createnode(){
Node* node = malloc(sizeof(*node));
return node;
}
void addNode(Node** head, int info){