Skip to content

Instantly share code, notes, and snippets.

View ShawonAshraf's full-sized avatar
🐈
I'm simply not there.

Shawon Ashraf ShawonAshraf

🐈
I'm simply not there.
View GitHub Profile
@ShawonAshraf
ShawonAshraf / bootable-win-on-mac.md
Created February 6, 2025 00:51 — forked from acarril/bootable-win-on-mac.md
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

package org.playerchat.core;
import org.playerchat.utils.MessageCounter;
import org.playerchat.utils.MessageLogger;
import org.playerchat.utils.Operations;
import java.io.*;
import java.net.Socket;
public class PlayerMultiProcess {
from llama_index.vector_stores.qdrant import QdrantVectorStore
def get_forward_nodes(
node_with_score: NodeWithScore, num_nodes: int, vector_store: QdrantVectorStore
) -> Dict[str, NodeWithScore]:
"""Get forward nodes."""
node = node_with_score.node
nodes: Dict[str, NodeWithScore] = {node.node_id: node_with_score}
cur_count = 0
# get forward nodes in an iterative manner
@ShawonAshraf
ShawonAshraf / claude_3.5_sonnet_artifacts.xml
Created July 3, 2024 14:10 — forked from dedlim/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@ShawonAshraf
ShawonAshraf / main.py
Created April 12, 2024 15:18
Ollama + Distilabel
import os
import shutil
if os.path.exists(".cache/distilabel"):
shutil.rmtree(".cache/distilabel")
from distilabel.steps.tasks import TextGeneration
from distilabel.steps import LoadHubDataset
from distilabel.pipeline.local import Pipeline
@ShawonAshraf
ShawonAshraf / main.py
Created April 11, 2024 20:11
vllm request
import openai
from pydantic import BaseModel, Field
import json
class ResponseStructure(BaseModel):
bookname: str = Field(..., title="Book Name")
author: str = Field(..., title="Author")
reading_list_name: str = Field(..., title="Reading List Name")
@ShawonAshraf
ShawonAshraf / phase.c
Created October 11, 2023 22:00
STM32 Phase Change
#include "stm32f4xx.h"
#include "stm32f4xx_hal.h"
ADC_HandleTypeDef hadc1;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_ADC1_Init(void);
int main(void) {
# Import the required libraries
from collections import defaultdict
# Define the Chu-Liu/Edmonds algorithm function
def chu_liu_edmonds(graph):
# Step 1: Contract the graph to a single node
contracted_node = max(graph.keys()) + 1
contracted_graph = defaultdict(list)
for node in graph:
for (weight, child) in graph[node]:
import pynvml
pynvml.nvmlInit()
device_count = pynvml.nvmlDeviceGetCount()
for i in range(device_count):
try:
handle = pynvml.nvmlDeviceGetHandleByIndex(i)
util = pynvml.nvmlDeviceGetUtilizationRates(handle)
import torch.nn as nn
from einops.layers.torch import Rearrange
from transformers import AutoModel
class DummyModel(nn.Module):
def __init__(self, textmodel_weight_name, task_name, batch_size, freeze_text_model=False):
super(DummyModel, self).__init__()
self.task_name = task_name