Skip to content

Instantly share code, notes, and snippets.

View mohnish4795's full-sized avatar

Mohnish mohnish4795

View GitHub Profile
@veekaybee
veekaybee / normcore-llm.md
Last active November 2, 2025 20:52
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@anchan828
anchan828 / README.md
Last active April 1, 2025 14:23
This is an improvement to allow @nestjs/typeorm@8.1.x to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

@clementgalopin
clementgalopin / index.js
Created February 14, 2022 19:21
AWS s3 Unzip/Gunzip
'use strict';
/* -------- What does this script do? --------
This script is meant to be used inside of an AWS lambda to automatically unzip/gunzip files that are created inside of an s3 bucket.
------------------------------------------- */
/* -------------------- Setup --------------------
1. Create your s3 bucket
2. Download this file locally, change the bucket variable value to your s3 bucket name, install all required modules and zip all of that together
3. Create a lambda and import the .zip code inside of it
@MadMaxStepan
MadMaxStepan / file-store.service.ts
Last active May 26, 2022 15:19
Nest code samples
import { Injectable, HttpException, HttpStatus } from '@nestjs/common';
import * as multer from 'multer';
import * as multerS3 from 'multer-s3';
import { v4 as uuid } from 'uuid';
import { Validator } from 'class-validator';
import { S3 } from 'aws-sdk';
import s3 from './aws.service';
import { MimeType } from '../enums/mimeType.enum';
import { TWO_HOURS } from '../../common/constants/common.constants';
import {
NestInterceptor,
ExecutionContext,
Injectable,
CallHandler,
} from '@nestjs/common';
import { classToPlain } from 'class-transformer';
import { map } from 'rxjs/operators';
@Injectable()
@jaytaph
jaytaph / AWS components.txt
Last active March 20, 2025 21:25
A list of AWS components and what they do.
Compute
EC2 Virtual Private Servers
Lightsail Amazon's hosting provider (vps, dns, storage)
Lambda Functions you can run, written in Python, NodeJS, Go etc. Can run many in parallel.
Batch Run software jobs on EC2 machines
Elastic Beanstalk Run software on managed virtual machines
Serverless Application Repository Repository of serverless applications that you can deploy (on lambda)
AWS Outposts Basically run Amazon services on your own hardware (datacenter)
EC2 Image Builder Create EC2 (ami?) images automatically
@KieronQuinn
KieronQuinn / jschwatt.js
Last active February 2, 2021 23:00
@jschwatt_owo
var Twit = require('twit')
const owo = require('@zuzak/owo')
var T = new Twit({
consumer_key: '',
consumer_secret: '',
access_token: '',
access_token_secret: '',
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
strictSSL: false, // optional - requires SSL certificates to be valid.
const { MongoClient } = require('mongodb');
const axios = require('axios');
const createStream = require('./tweetCrawler');
// Either take the MongoDB connection string from envrionment variable MONGODB_URL or the local mongodb 'twtsnt'
const url = process.env.MONGO_URL || 'mongodb://localhost:27017/twtsnt';
const dbName = 'twtsnt';
// Create a MongoDB client instance
const client = new MongoClient(url, { useNewUrlParser: true });
const Twit = require('twit');
const Sentiment = require('sentiment');
// Create a sentiment instance
const sentiment = new Sentiment();
// Create a Twit instance
const T = new Twit({
consumer_key: 'consumer key obtained from twitter developer', // Twitter Developer - https://developer.twitter.com
consumer_secret: 'consumer secret obtained from twitter developer',

Using server-sent events

Why and how?

  • Documentation: https://web.dev/articles/eventsource-basics
  • Use case: broadcasting data from server to browsers
  • Benefits:
    • Easy to understand and implement (only a few lines of code)
    • No library is needed
  • Can use same HTTP(S) authentication as elsewhere in the app (which can’t be done with websockets)