Skip to content

Instantly share code, notes, and snippets.

View zsnmwy's full-sized avatar
💭
I may be slow to respond.

zsnmwy

💭
I may be slow to respond.
View GitHub Profile
@irazasyed
irazasyed / outbound-email-with-cloudflare.md
Last active April 21, 2024 18:54
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

@sindresorhus
sindresorhus / esm-package.md
Last active April 24, 2024 09:47
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@zerebral
zerebral / puppeteer-stealth-with-browserless.js
Last active September 1, 2023 22:35
Use puppeteer-extra-plugin-stealth with Browserless
const puppeteer_extra = require('puppeteer-extra');
puppeteer_extra.use(require('puppeteer-extra-plugin-anonymize-ua')());
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer_extra.use(StealthPlugin());
module.exports = async ({ context, browser }) => {
const { url } = context;
const ws_endpoint_url = browser.wsEndpoint();
const newBrowser = await puppeteer_extra.connect({
browserWSEndpoint: ws_endpoint_url
@StevenACoffman
StevenACoffman / git-auto-sign-commits.sh
Last active October 5, 2023 08:13 — forked from mort3za/git-auto-sign-commits.sh
Auto sign your git commits
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C gears@umich.edu -N ''
# -o : Save the private-key using the new OpenSSH format rather than the PEM format. Actually, this option is implied when you specify the key type as ed25519.
# -a: It’s the numbers of KDF (Key Derivation Function) rounds. Higher numbers result in slower passphrase verification, increasing the resistance to brute-force password cracking should the private-key be stolen.
# -t: Specifies the type of key to create, in our case the Ed25519.
# -f: Specify the filename of the generated key file. If you want it to be discovered automatically by the SSH agent, it must be stored in the default `.ssh` directory within your home directory.
# -C: An option to specify a comment. It’s purely informational and can be anything. But it’s usually filled with <login>@<hostname> who generated the key.
# -N: Provides the new passphrase.
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_ed25519
@luksi1
luksi1 / centos-loopback-interface
Created February 8, 2019 15:06
Add Virtual IP address to a loopback interface in Ubuntu and CentOS/Redhat
# /etc/sysconfig/ifcfg-lo
DEVICE=lo
# localhost
IPADDR0=127.0.0.1
NETMASK0=255.0.0.0
NETWORK0=127.0.0.0
BROADCAST0=127.255.255.255
# virtual ip
IPADDR1=<VIRTUAL IP ADDRESS>
NETMASK1=255.255.255.255
@bagder
bagder / trrprefs.md
Last active December 27, 2022 05:17
This once held TRR prefs. Now it has moved.

NOTE

This content has moved.

Please go to bagder/TRRprefs for the current incarnation of the docs, and please help us out polish and maintain this documentation!

@bufadu
bufadu / howto_bgp_ecmp_load_balancing.md
Last active March 2, 2024 19:13
BGP ECMP Load Balancer

How to build a load balancer with BGP and ECMP using VyOS

According to this cloudflare blog article "Load Balancing without Load Balancers", we can build a rock-solid load balancer only using a router. All the magic comes from BGP and Equal-Cost Multi-Path routing.

In this howto, I will use bird as BGP router on linux instance (ie. servers).

Test environment

I use GNS3 with this architecture :

architecture

@kekru
kekru / add CA cert on CentOS Debian Ubuntu.md
Last active October 23, 2023 08:21
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org
@devisnotnull
devisnotnull / installing_kubernetes_on_proxox.md
Last active January 1, 2024 12:33
Installing Kubernetes on Proxox, Herzner

Installing Kubernetes on Proxox

For this example i shall be using a dedicated server from Hertzner.https://www.hetzner.de/en/. A shout out to hetzner if your looking for cheap and beefy dedicated hosting then these guys are your best bet.

Setting up the Hertzer server

This guide assumes your server has Debian 8 (Jessie installed)

Config when tested

@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4