This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
Worker, | |
isMainThread, | |
parentPort, | |
workerData, | |
MessageChannel, | |
} = require("node:worker_threads"); | |
const http = require("node:http"); | |
if (isMainThread) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import pandas as pd | |
import re | |
def parse_gc_log(gc_log): | |
# Split the input log by lines | |
lines = gc_log.split("\n") | |
# Prepare lists for each graph's data | |
gc_timing = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
lsb_release -a | |
add-apt-repository ppa:deadsnakes/ppa --yes | |
apt install python3.11 python3.11-venv python3.11-dev | |
python3.11 -m venv env | |
source env/bin/activate | |
pip install packaging wheel | |
pip install https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp311-cp311-linux_x86_64.whl#sha256=d4c3e9a8d31a7c0fcbb9da17c31a1917e1fac26c566a4cfbd8c9568ad7cade79 | |
pip install --no-build-isolation 'instructlab[cuda]' -C cmake.args="-DLLAMA_CUDA=on" -C cmake.args="-DLLAMA_NATIVE=off" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const users = [ | |
{ id: 'user_111', email: '[email protected]' }, | |
{ id: 'user_222', email: '[email protected]' }, | |
{ id: 'user_333', email: '[email protected]' }, | |
] | |
// Wait for all the get operations to complete and store the results. | |
const getResults = await Promise.all( | |
users.map((user) => { | |
console.log(`Getting document: ${user.id}`) | |
return usersCollection.get(user.id, user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
from pymongo import MongoClient | |
from couchbase.cluster import Cluster | |
from couchbase.management.buckets import BucketManager | |
from couchbase.options import ClusterOptions | |
from couchbase.auth import PasswordAuthenticator | |
import os | |
import string | |
from tqdm import tqdm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <random> | |
#include <algorithm> | |
#include <numeric> | |
#include <thread> | |
#include <mutex> | |
const int num_simulations = 10000; // Number of Monte Carlo simulations | |
const int num_days = 252; // Number of trading days in a year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
# Define the Transformer model architecture | |
class Transformer: | |
def __init__(self, input_vocab_size, output_vocab_size, max_seq_length, d_model, num_heads, num_layers): | |
self.input_vocab_size = input_vocab_size | |
self.output_vocab_size = output_vocab_size | |
self.max_seq_length = max_seq_length | |
self.d_model = d_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# The cheapest CUDA instance on AWS is Graviton2 based g5g instances | |
# 1) Install right CUDA Drivers on the system. Whilst this script has been tested on Ubuntu 22.04. It should work on others | |
# 2) Install torch with GPU support. Compiling from source works the best | |
# 3) Preferably Quantize the models - https://huggingface.co/docs/transformers/main/en/main_classes/quantization | |
# | |
# Author: Supreet Sethi <[email protected]> | |
# Web: https://www.linkedin.com/in/djinn | |
# | |
# Step 1) is here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from json import dumps | |
test_load = """SQL statistics: | |
queries performed: | |
read: 845684 | |
write: 241589 | |
other: 120831 | |
total: 1208104 | |
transactions: 60398 (1506.89 per sec.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author Supreet Sethi <[email protected]> | |
# Dated Thu Jul 21 13:26:06 +08 2022 | |
# Instructions - wget <script>; chmod +x yubikey.sh; ./yubikey.sh | |
sudo pmset -a hibernatemode 25 && sudo pmset -a standbydelay 15 | |
echo "Yubikey hibernation changes installed" |
NewerOlder