Skip to content

Instantly share code, notes, and snippets.

View haydar's full-sized avatar
🎯
Focusing

Haydar ŞAHİN haydar

🎯
Focusing
View GitHub Profile
@christeredvartsen
christeredvartsen / README.md
Created September 25, 2020 09:12
Simple retry strategy for Guzzle 7 when encountering "429 Too Many Requests" errors

Simple retry strategy for Guzzle 7

APIs might implement rate limiting, and if they do your clients might experience 429 Too Many Requests responses with a Retry-After header, informing your client how long it should wait before making the next request. And being good internet citizens we should all implement support for this in our API clients.

Guzzle includes a retry middleware class that can be used to handle this.

The implementation in this gist is a PoC, so feel free to build upon it, and comment if you think something should be added / removed.

@jonathanbossenger
jonathanbossenger / sitesetup.sh
Last active April 25, 2024 23:13
Bash script to automatically provision LAMP sites
#!/bin/bash
# Bash script to set up local site using LAMP on Ubuntu
# Requires Apache2, MySQL, mkcert (https://github.com/FiloSottile/mkcert)
# See also sitedrop.sh https://gist.github.com/jonathanbossenger/4950e107b0004a8ee82aae8b123cce58
HOME_USER=jonathan
SSL_CERTS_DIRECTORY=/home/jonathan/ssl-certs
SITES_DIRECTORY=/home/jonathan/development/websites
@ibrahimtuzlak0295
ibrahimtuzlak0295 / xampp-virtualhost.md
Last active May 24, 2023 16:21
Create virtual host in XAMPP, Ubuntu 16.04/18.04/20.04/22.04

I’ll go step-by-step on how to create a virtual host in the XAMPP environment. As we know, the default http://localhost points to /opt/lampp/htdocs as the root directory. The desired result is to be able to visit http://examplevhost.local, with the root directory being /opt/lampp/htdocs/examplevhost.

Note: The steps below are done on Ubuntu 16.04, but they should also work on most other Linux distributions (Debian, Mint, Arch).

Note: I’ll assume that XAMPP is installed in /opt/lampp/. If it’s different on your setup, please read carefully and adjust accordingly.

Enable virtual hosts in apache configuration file

Note: This should be done only once per XAMPP installation. If you want to add another virtual host later you can skip to the next step.

@eculver
eculver / replace_apt_sources.sh
Created December 26, 2013 00:02
Replace default Ubuntu apt repository URLs w/ DigitalOcean's
sudo sed -i "s/archive\.ubuntu/mirrors.digitalocean/g" /etc/apt/sources.list