Skip to content

Instantly share code, notes, and snippets.

View ragrag's full-sized avatar

Ragy Hosny ragrag

View GitHub Profile
@ragrag
ragrag / README.md
Last active May 30, 2024 09:40
Manually Add K8s Cluster to ArgoCD

Manually Add K8s Cluster to ArgoCD, this does not break existing ArgoCD instances where the cluster is already added

After applying the manifest, you can add the cluster with argocd cli with

argocd login argo-server.domain.com
argocd cluster add <kube-context> --service-account=argocd-custom-manager
@ragrag
ragrag / argo-cluster-add.sh
Created May 30, 2024 09:36
Manually Add K8s Cluster to ArgoCD,
argocd login argo-server.domain.com
argocd cluster add <kube-context> --service-account=argocd-custom-manager
@ragrag
ragrag / poor.ssr.js
Created June 28, 2023 20:44
Poor man's ssr
/* eslint-disable */
const fastify = require('fastify');
const { createLogger } = require('@condo/logger');
const config = require('config');
const path = require('path');
const fastifyStatic = require('@fastify/static');
const logger = createLogger(config.get('logger'));
const replaceStream = require('replacestream');
const zlib = require('zlib');
const { PassThrough } = require('stream');
@ragrag
ragrag / retry-after-429.js
Created May 26, 2022 22:46
axios-retry with 429 honoring
axiosRetry(axios, {
retryCondition: (e) => {
return (
axiosRetry.isNetworkOrIdempotentRequestError(e) ||
e.response.status === 429
);
},
retryDelay: (retryCount, error) => {
if (error.response) {
const retry_after = error.response.headers["retry-after"];
@ragrag
ragrag / app.ts
Last active February 14, 2021 13:23
Add a Pub/Sub layer to your express backend
private initializeServices() {
new AnalyticsService();
new EmailService();
new SMSService();
}
import axios from "axios";
export default (history = null) => {
const baseURL = process.env.REACT_APP_BACKEND_URL;
let headers = {};
if (localStorage.token) {
headers.Authorization = `Bearer ${localStorage.token}`;
The WSL 2 docker-desktop-data vm disk image would normally reside in: %USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx
Follow the following to relocate it to other drive/directory, with all existing docker data preserved (tested against Docker Desktop 2.3.0.4 (46911):
First, shut down your docker desktop by right click on the Docker Desktop icon and select Quit Docker Desktop
Then, open your command prompt:
wsl --list -v
You should be able to see, make sure the STATE for both is Stopped.
@ragrag
ragrag / Generate JWT Secret
Created December 29, 2020 20:03
Generate JWT Secret
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
@ragrag
ragrag / _app.tsx
Last active March 24, 2020 16:37
Making easy-peasy work globally with Nextjs
import { AppProps } from 'next/app';
import { withStore } from '../store/withStore';
function MyApp({ Component, pageProps }: AppProps) {
return (
<Component {...pageProps} />
);
}
export default withStore(MyApp);
@ragrag
ragrag / docker-help.md
Last active February 15, 2019 11:42 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info