Skip to content

Instantly share code, notes, and snippets.

View salman0ansari's full-sized avatar
🟢
$ yay -S brain

Mohd Salman salman0ansari

🟢
$ yay -S brain
View GitHub Profile
@salman0ansari
salman0ansari / index.js
Created September 10, 2024 07:18
Luhn's Algorithm
// https://x.com/cneuralnetwork/status/1831989042826629546
const digits = "4137894711755904";
let sum = [];
digits.split("").map((digit, index) => {
if (index % 2 === 0) {
const double = +digit * 2;
if (double > 9) {
let pushItem = String(double)
---
swagger: "2.0"
info:
description: |
This is a swagger defenition for [Telegram bot API](https://core.telegram.org/bots/api).
version: "3.6"
title: Telegram Bot API
host: api.telegram.org
schemes:
- https

1. Install Node/NPM

curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -

sudo apt install nodejs

sudo apt install npm
@salman0ansari
salman0ansari / storage-notify.sh
Created September 13, 2023 14:08
get telegram notification if storage is above x%
#!/bin/bash
check_storage() {
# Get the disk usage percentage
usage=$(df -h --output=pcent / | tail -n 1 | tr -d ' %')
if [ "$usage" -ge 70 ]; then
return 0
else
return 1
fi
import React, { useEffect } from 'react';
import { Space, Table, Tag } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { atom, useAtom } from 'jotai'
import { currentTableData } from './atoms';
interface DataType {
Id: string;
Jid: string;
Name: string;
@salman0ansari
salman0ansari / buffer.ts
Created March 25, 2023 08:30
puppeteer serverless
import chromium from '@sparticuz/chrome-aws-lambda';
export const GenerateBuffer = async (content) => {
try {
const puppeteer = chromium.puppeteer;
const browser = await puppeteer.launch({
args: chromium.args,
executablePath: await chromium.executablePath,
});
console.log('We have a browser', browser);
@salman0ansari
salman0ansari / hwid.go
Created March 12, 2023 13:08
hwid generator
package main
import (
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
"io/ioutil"
@salman0ansari
salman0ansari / twitter-query.php
Created January 26, 2023 12:25 — forked from AzureFlow/twitter-query.php
Get last X tweets from a user.
<?php declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\RequestOptions;
// ==================== //
@salman0ansari
salman0ansari / genAuth.js
Created October 17, 2022 16:32
generate auth
const cryptoJS = require("crypto-js")
function genAuth() {
let e = (new Date).toUTCString()
, t = cryptoJS.enc.Utf8.parse((!0 ? "PaRr8".split("").reverse().join("") : "") +
function (e) {
return e ? "s7Xp?".split("").reverse().join("") : ""
}(!0) +
function (e) {
return e ? "%#5hf".split("").reverse().join("") : ""
@salman0ansari
salman0ansari / .zsh_aliases
Created September 10, 2022 13:48
zsh alias
alias pacup="sudo pacman -Syu"
alias yayup="yay -Syu"
alias cleanup="yay -Scc"
alias server="ssh ubuntu@$IP -i ~/.ssh/mumbaiaws.pem"
alias printpath="echo $PWD"
# spelling correction
alias exi="exit"
alias exti="exit"
alias eitx="exit"