Skip to content

Instantly share code, notes, and snippets.

View vithalreddy's full-sized avatar
🔥

Vithal Reddy vithalreddy

🔥
View GitHub Profile
@rameerez
rameerez / telegram-mtproxy.md
Last active May 18, 2024 01:51
Telegram Proxy How-To: complete and up-to-date MTProxy tutorial

How to set up a Telegram Proxy (MTProxy)

This tutorial will teach you how to set up a Telegram MTProxy on an Ubuntu 22.04 sever using AWS Lightsail, although you can use any other Linux distribution and cloud provider.

Using a Telegram proxy is a safe, easy and effective way of overcoming Telegram bans. It's useful, for example, to keep using Telegram under tyrannical regimes, or to circumvent judges' decisions to block Telegram.

Telegram proxies are a built-in feature in all Telegram apps (both mobile and desktop). It allows Telegram users to connect to a proxy in just one or two clicks / taps.

Telegram proxies are safe: Telegram sends messages using their own MTProto secure protocol, and the proxy can only see encrypted traffic – there's no way for a proxy to decrypt the traffic and read the messages. The proxy does not even know which Telegram users are using the proxy, all the proxy sees is just a list of IPs.

@vithalreddy
vithalreddy / rules_of_trade.md
Last active March 22, 2024 06:18
Rules of Trade -> FnO Options selling

✨ Rules of Trade ✨

  • Entry is free, Exit is not 🙅‍♂️
    • Don't enter, if you do enter follow the rules of engagement
    • Wait for SL and TP
    • One sec away from screen can blow your account 💯
  • Strike Selection and RR ratio Matters📊
    • Before entering any trade, please check it's strike price, delta and RR ratio
  • RRR: Your Key to Success🔑
    • Only Risk management is the real edge, everything else is just the smoke
@adtac
adtac / Dockerfile
Last active April 13, 2024 22:33
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@pilcrowOnPaper
pilcrowOnPaper / crypto-random.ts
Last active January 3, 2024 18:55
Cryptographically strong Math.random(). Generate cryptographically strong random float between 0-1. Uses 52 bits instead of 32.
function random(): number {
const buffer = new ArrayBuffer(8);
const bytes = crypto.getRandomValues(new Uint8Array(buffer));
// sets the exponent value (11 bits) to 01111111111 (1023)
// since the bias is 1023 (2 * (11 - 1) - 1), 1023 - 1023 = 0
// 2^0 * (1 + [52 bit number between 0-1]) = number between 1-2
bytes[0] = 63;
bytes[1] = bytes[1] | 240;
@gimenete
gimenete / safeParse.ts
Last active March 15, 2024 16:05
A wrapper around the fetch function that validates the response body against a Zod schema
import z from "zod";
export async function safeFetch<T>(
schema: z.Schema<T>,
input: RequestInfo,
init?: RequestInit
): Promise<T> {
const response = await fetch(input, init);
if (!response.ok) {
@sayandedotcom
sayandedotcom / gist:cfd39848edd55a2955b2a5efea99dc8e
Created July 30, 2023 16:22
React Select Library with shadcnui's design systems and forms !
1. Select Component ---------------------------------------------------------------------------------
"use client";
import clsx from "clsx";
import { ChevronDownIcon, X } from "lucide-react";
import Select, {
ClearIndicatorProps,
DropdownIndicatorProps,
MultiValueRemoveProps,
@srsandy
srsandy / ColumnFilter.js
Last active January 11, 2024 06:54
React Table Server side Pagination and Filtering
import "regenerator-runtime/runtime";
import { useState } from "react";
import { useAsyncDebounce } from "react-table";
const ColumnFilter = ({ column }) => {
const { filterValue, setFilter } = column;
const [value, setValue] = useState(filterValue);
const onChange = useAsyncDebounce((value) => {
setFilter(value || undefined);
}, 300);
@qiangxue
qiangxue / cloudwatch_log_insights_mysql_slow_query_examples.md
Created October 20, 2020 19:28 — forked from grocky/cloudwatch_log_insights_mysql_slow_query_examples.md
CloudWatch Log Insights query examples for MySQL slow query log.

Filtering queries

Find slowest write queries

parse @message /Query_time: (?<queryTime>.*?) Lock_time: (<?lockTime>.*?) Rows_sent: (?<rowsSent>.*?) Rows_examined: (?<rowsExamined>.*?)\s(?<query>.*?)$/
  | filter @message like /(?i)insert/
  | sort queryTime desc
  | limit 10
@slavivanov
slavivanov / get_raw_sql.ts
Created June 18, 2020 09:12
Get generated SQL query from Sequelize
import * as Sequelize from "sequelize";
import uuidv1 = require("uuid/v4");
import { SequelizeModelStatic } from "./sequelize";
import * as pLimit from "p-limit";
import _ = require("lodash");
/**
* Get generated SQL query from sequelize. Returns a promise that:
* 1. Adds a hook that receives the prepared options from Sequelize
* - Since hooks work on the whole model,
@rylev
rylev / rust-in-large-organizations-notes.md
Last active February 2, 2023 10:08
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support