Skip to content

Instantly share code, notes, and snippets.

View Sikandarkhan's full-sized avatar

phoenixikanda Sikandarkhan

View GitHub Profile
@Sikandarkhan
Sikandarkhan / nginx s3
Last active June 20, 2023 18:06
NGINX with AWS S3 static web server
# Proxy configuration
proxy_http_version 1.1;
proxy_ignore_headers 'Set-Cookie';
proxy_buffering off;
proxy_intercept_errors on;
proxy_method GET;
proxy_set_header Host 'bucket.s3-website-sa-east-1.amazonaws.com';
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
@timothydplatt
timothydplatt / Update Progress Ring.swift
Created January 22, 2019 16:42
Update Progress Ring
func updateProgressRingForMinFixedAmount(minFixedAmount: String) {
let payDownTimeIfPayingFixedAmount = fixedAmountCalculator.fixPayCalculator(userFixedAmount: minFixedAmount, balance: String(balance), APR: String(APR), repaymentType: 1, percentOfBalance: String(percentageOfBalance), fixedAmount: String(repaymentAmount), percentOfBalanceOnly: String(percentageOfBalanceOnly))
progressRing.startProgress(to: UICircularProgressRing.ProgressValue(Float(payDownTimeIfPayingFixedAmount.payDownTime)), duration: 2.0) {
let payDownDifference = self.payDownTime - payDownTimeIfPayingFixedAmount.payDownTime
let interestDifference = self.cumulativeInterest - payDownTimeIfPayingFixedAmount.cumulativeInterestRounded
self.updateDifferenceLabel(fixedAmount: minFixedAmount, payDownDifference: payDownDifference, interestDifference: interestDifference)
}
@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
@mozillazg
mozillazg / supervisord.service
Last active December 1, 2023 12:59 — forked from tonyseek/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 28, 2024 08:25
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers