Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
rethinking

Arnab Paryali ArnabXD

:octocat:
rethinking
View GitHub Profile
@ArnabXD
ArnabXD / filterUrls.ts
Created Sep 12, 2022
GramJS - Get all links from message text
View filterUrls.ts
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 Oct 21, 2021
Github Action - React Native - Android APK Build
View apk-build.yml
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
View YTMP3 API with ytdl-core.md
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 Aug 2, 2021 — forked from simon04/git.sh
Git merge/replace orphan branch into main
View git.sh
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 Apr 21, 2022
NextJS+TypeScript+FC Authentication HOC example
View withAuth-HOC.md

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 Mar 12, 2021
Generate Telethon String Session
View sessiongen.sh
pkg install python wget -y && pip install telethon && wget https://raw.githubusercontent.com/TeamUltroid/ultroid/main/resources/session/ssgen.py && python3 ssgen.py