Skip to content

Instantly share code, notes, and snippets.

View ahmic's full-sized avatar
🏠
Working from home

Amir Ahmic ahmic

🏠
Working from home
  • OLX Group
  • Sarajevo, BA
View GitHub Profile
@eveningkid
eveningkid / pan-responder-pan-scale-image-example.jsx
Created February 19, 2021 17:54
React Native Pan Responder example to pan/scale an image
import React, { useRef } from 'react';
import {
Animated,
Image,
PanResponder,
useWindowDimensions,
} from 'react-native';
const IMAGE_URI =
'https://vignette.wikia.nocookie.net/joke-battles/images/4/40/18360-doge-doge-simple.jpg/revision/latest?cb=20151209161638';
@danshev
danshev / lambda_function.py
Last active May 20, 2022 09:23
TeslaCam-Merge-Videos (for AWS Lambda)
'''
Function: TeslaCam-Merge-Videos
Runtime: Python 3.7
Environment: AWS Lambda
Description:
This function is meant to be invoked by another Lambda (TeslaCam-Identify-Sets-and-Kickoff).
Upon execution, it will use the 'event' key of the event dictionary (passed at runtime), and:
1. Download camera angle video files from S3
@ibraheem4
ibraheem4 / postgres-brew.md
Last active July 18, 2024 00:18 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@homaily
homaily / index.js
Last active December 16, 2022 13:13
Lambda download and cache gzipped file from s3
'use strict';
console.log('// loading function');
const aws = require('aws-sdk');
const s3 = new aws.S3({apiVersion: '2006-03-01'});
const gzip = require('zlib').createGunzip();
const fs = require('fs');
@fyrebase
fyrebase / guide.md
Created December 2, 2015 10:02
Setup individual pools for PHP-FPM and NGINX - http://www.binarytides.com/php-fpm-separate-user-uid-linux/

Php-FPM

Php fpm is the new way to setup php to run with your webserver. Php-fpm is a fastcgi process manager for php that is totally separate from the webserver. The webserver communicates with fpm through a socket and passes the name of the script to execute. So fpm can run with any web server that is fastcgi compatible.

I recently moved from my old shared hosting to linode. Linode provides linux vps hosting at economic prices. However the servers are totally unmanaged are just raw linux machines that have shell access. So through the shell you have to setup everything including the web server, php and the web files.

So this time I decided to go with the combination of nginx and php-fpm. I had multiple sites to setup on this new webserver. Nginx deals with these through separate server blocks (aka vhost in apache). However there was another thing needed. Php on each site should run with its own user and not the nginx common user named www-data.

Running each site with its own uid/gid is more secure and