Skip to content

Instantly share code, notes, and snippets.

View ArnabXD's full-sized avatar
:octocat:
rethinking

Arnab Paryali ArnabXD

:octocat:
rethinking
View GitHub Profile
@ArnabXD
ArnabXD / filterUrls.ts
Created September 12, 2022 14:36
GramJS - Get all links from message text
interface BaseTextEntities extends Record<string, unknown> {
offset: number;
length: number;
className: string;
}
type TextEntities = [BaseTextEntities, string];
export function filterUrls(entity: TextEntities[]): Array<string> {
return entity
.filter(([_e]) =>
@ArnabXD
ArnabXD / apk-build.yml
Created October 21, 2021 14:27
Github Action - React Native - Android APK Build
name: Apk Build
on: workflow_dispatch
jobs:
build-android:
runs-on: ubuntu-latest
env:
commit-hash: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
- uses: c-hive/gha-yarn-cache@v1
import ytdl from 'ytdl-core';

// ....
 
fastify.get('/ytmp3', async (req, res) => {
        let { id, lang } = req.query;
        if (!ytdl.validateID(id)) {
            res.send({
 result: false,
@ArnabXD
ArnabXD / git.sh
Last active August 2, 2021 07:03 — forked from simon04/git.sh
Git merge/replace orphan branch into main
git checkout --orphan new
# completely rewrite your application in new framework
git merge --strategy=ours --allow-unrelated-histories main
git commit-tree -p HEAD^2 -p HEAD^1 -m "Merge branch 'new'" "HEAD^{tree}"
git reset --hard $OUTPUT_FROM_PREVIOUS_COMMAND
git checkout main
git merge --ff-only new
@ArnabXD
ArnabXD / withAuth-HOC.md
Last active April 21, 2022 15:53
NextJS+TypeScript+FC Authentication HOC example

NextJS TypeScript Higher Order Functional Component

import { useState, useEffect, FC } from 'react';
import { useRouter } from 'next/router';

export const withAuth = <P extends object>(C: FC<P>) => {
    return (props: P) => {
        const router = useRouter();
 useEffect(() =&gt; {
@ArnabXD
ArnabXD / sessiongen.sh
Created March 12, 2021 07:27
Generate Telethon String Session
pkg install python wget -y && pip install telethon && wget https://raw.githubusercontent.com/TeamUltroid/ultroid/main/resources/session/ssgen.py && python3 ssgen.py