Skip to content

Instantly share code, notes, and snippets.

View sigismund's full-sized avatar

Žiga Drnovšček sigismund

View GitHub Profile
@peterneave
peterneave / generate_allowed_list.sh
Last active February 5, 2020 14:24
Setup Linux UFW Firewall to accept Atlassian IP addresses only
#!/usr/bin/env bash
> allowed_ranges
#Bamboo Triggers
echo '18.205.93.0/25' >> allowed_ranges
echo '18.234.32.128/25' >> allowed_ranges
echo '13.52.5.0/25' >> allowed_ranges
#Atlassian IP Addresses
curl -s https://ip-ranges.atlassian.com/ | jq -r '.items[] | .cidr' >> allowed_ranges
echo Allowed Ranges file generated
@holmberd
holmberd / php-pools.md
Last active April 19, 2024 07:24
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@devmycloud
devmycloud / ParseInputStream.php
Last active December 6, 2023 15:22
Process php://input to get multipart/form-data parameters for PATCH API request
<?php
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* stream - Handle raw input stream
*
* LICENSE: This source file is subject to version 3.01 of the GPL license
* that is available through the world-wide-web at the following URI:
@mtrunkat
mtrunkat / docker-mongo-repair
Last active March 19, 2024 06:28
Run "mongo --repair" in Docker container that cannot start because of MongoDB error
#!/bin/bash
# See https://github.com/docker-library/mongo/pull/63
docker run --rm --volumes-from my-mongo-server mongo unlink "/data/db/mongod.lock"
docker run --rm --volumes-from my-mongo-server mongo --repair
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active April 3, 2024 06:54
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@eladnava
eladnava / mongodb-s3-backup.sh
Last active March 11, 2024 10:21
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh