Skip to content

Instantly share code, notes, and snippets.

View imkarimkarim's full-sized avatar
🔭
crawling the internet

karim imkarimkarim

🔭
crawling the internet
View GitHub Profile
@imkarimkarim
imkarimkarim / axiosInstance.ts
Last active July 26, 2024 11:30
axiosInstance.ts
// axiosInstance example with good logging for developers
import axios from 'axios';
import { API_PREFIX, API_URL } from '../config';
import { getUserToken } from '../auth';
const userToken = getUserToken();
const headers: any = {};
if (userToken) {
headers.Authorization = `Bearer ${userToken}`;
@imkarimkarim
imkarimkarim / .zshrc
Created June 8, 2024 09:25
start ssh agent on login
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2=agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
@imkarimkarim
imkarimkarim / nvchad.cheatsheet
Last active June 6, 2024 10:11
chad-cheats (nvchad cheatsheet)
chad-cheats:
# based on: https://youtu.be/Mtgo-nP_r8Y
space + h + t : change theme
:TSInstall <language>(elixir) : add syntax highlighting support
:TSInstallInfo : see what syntax highlighting are already installed
@imkarimkarim
imkarimkarim / redditCleaner.js
Last active April 7, 2024 21:05
click on reddits "RECENT", "CUSTOME FEED" and "Clear(history)" buttons with js.
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const t = 50;
(async () => {
let f1 = false;
while (!f1) {
let jsPath;
@imkarimkarim
imkarimkarim / setNewVersion.js
Last active December 30, 2023 23:26
version setter script
// nodejs script that adds a new version to the project. (git(local, and remote), package.json and a commit message)
// example: node setNewVersion.js 0.0.1
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
let v = process.argv[2];
if (v.charAt(0) === 'v') {
v = v.substring(1);
@imkarimkarim
imkarimkarim / .eslintignore
Created December 13, 2023 04:22
karim project configs and helpers
node_modules
build
scripts/setNewVersion.js
@imkarimkarim
imkarimkarim / Example.tsx
Last active December 13, 2023 07:43
Pure React OTP input
import React from "react";
export default function Example() {
return <OtpInput value={otp} onChange={(value: string) => setOtp(value)} />;
}
@imkarimkarim
imkarimkarim / extensions.json
Last active May 30, 2024 13:48
VSCode's Settings - Syncing
[
{
"id": "aaron-bond.better-comments",
"name": "better-comments",
"publisher": "aaron-bond",
"version": "3.0.2"
},
{
"id": "adpyke.codesnap",
"name": "codesnap",
@imkarimkarim
imkarimkarim / x-ui_default_credentials.txt
Created April 11, 2023 09:17
x-ui default credentials
port: 54321
user: admin
pass: admin
@imkarimkarim
imkarimkarim / ContextProvider.tsx
Last active September 5, 2023 07:38
React Context in Typescript
import { createContext, FC, useContext, useState } from 'react';
const Context = createContext<any>(null);
type Props = {
children: JSX.Element[] | JSX.Element | string;
};
const StateProvider: FC<Props> = ({ children }) => {
const [state, setState] = useState();