Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Waleed Gadelkareem gadelkareem

🎯
Focusing
View GitHub Profile
@gadelkareem
gadelkareem / certbot.sh
Created Apr 8, 2022
Letsencrypt DNS challenge wildcard certificate
View certbot.sh
sudo certbot -d "*.example.com" --manual --preferred-challenges dns certonly
@gadelkareem
gadelkareem / retry.sh
Created Mar 16, 2022
Retry Bash function
View retry.sh
#!/usr/bin/env bash
function retry {
local retries=$1
shift
local count=0
until "$@"; do
exit=$?
wait=$((2 ** $count))
@gadelkareem
gadelkareem / README.md
Last active Nov 26, 2021
Cryptocurrency prices calculation in Google Sheets
View README.md
  • Add your coinMarketCap private key YOUR_PRIVATE_KEY
  • Use =$COUNT_CELL*coingecko($SYMBOL_CELL) in your sheet
@gadelkareem
gadelkareem / fake.go
Created Oct 15, 2021
Fake server in golang
View fake.go
package main
import (
"bufio"
"fmt"
"log"
"net"
)
func handleConnection(conn net.Conn) {
@gadelkareem
gadelkareem / coinMarketCap.gs
Created Aug 16, 2021
Crypto coin prices on Google Sheets
View coinMarketCap.gs
/*
* use =coinMarketCap('ETH') in your sheet
*/
function coinMarketCap(symbol) {
const url = `https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=${symbol}&convert=EUR`
const headers = {
"X-CMC_PRO_API_KEY": 'API_KEY from https://pro.coinmarketcap.com/account'
};
View Squash.sh
git reset (git merge-base main (git branch --show-current))
git push --force
@gadelkareem
gadelkareem / cache-warmer.py
Last active Jun 18, 2021 — forked from hn-support/cache-warmer.py
A threaded cache warmer in python
View cache-warmer.py
#!/usr/bin/env python3
"""
Warm the caches of your website by crawling each page or sitemap index defined in sitemap.xml.
To use, download this file and make it executable. Then run:
./cache-warmer.py --threads 4 --interval 10 --file https://example.com/sitemap.xml -v
./cache-warmer.py --threads 4 --interval 10 --file /data/web/public/sitemap.xml -v
"""
import argparse
from multiprocessing.pool import ThreadPool
import os.path
View stop-terraform.sh
#Gently:
ps -ef | grep terraform | grep -v grep | awk '{print $2}' | xargs -n 1 kill
#Forcefully:
ps -ef | grep terraform | grep -v grep | awk '{print $2}' | xargs -n 1 kill -9
@gadelkareem
gadelkareem / lussh
Created Oct 20, 2020 — forked from enoch85/lussh
lussh - script to authorize your SSH key on a server
View lussh
#!/bin/bash
# make sure to run this with /bin/bash, NOT /bin/sh
echo
echo This script will help you setup ssh public key authentication.
host=dummy
@gadelkareem
gadelkareem / killfolder.groovy
Created Jul 9, 2020
Kill Jenkins jobs in a folder
View killfolder.groovy
import hudson.model.*
import jenkins.model.Jenkins
for (job in Jenkins.instance.items) {
if( job.getFullName().contains('my folder') ){
stopJobs(job)
}
}