Skip to content

Instantly share code, notes, and snippets.

@r-aamir
r-aamir / deploy.sh
Created January 4, 2024 21:39 — forked from stancl/deploy.sh
Deploy using GitHub actions and SSH to a VPS
#!/bin/sh
set -e
vendor/bin/phpunit
npm run prod
git add .
(git commit -m "Build frontend assets for deployment to production") || true
(git push) || true
#Random generator ipv6 addresses within your ipv6 network prefix.
#!/usr/local/bin/bash
# Copyright
# Vladislav V. Prodan
# universite@ukr.net
# 2011
array=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
@r-aamir
r-aamir / agGrid-ru.js
Created September 15, 2022 07:31 — forked from Norserium/agGrid-ru.js
Russian localization for agGrid / Русская локализация для agGrid
{
// for filter panel
page: 'Страница',
more: 'ещё',
to: 'к',
of: 'из',
next: 'Следующая',
last: 'Последняя',
first: 'Первая',
previous: 'Предыдущая',
@r-aamir
r-aamir / ffmpeg-libx264
Last active September 4, 2022 17:09
A benchmark of ffmpeg libx264 encoding with a range of CRF and presets
#!/bin/bash
infile="Test-15s.mov"
datafile="Test-15s.csv"
crfs=("18" "19" "20" "21" "22" "23" "24" "25" "26" "27")
presets=("ultrafast" "superfast" "veryfast" "faster" "fast" "medium" "slow" "slower" "veryslow")
echo 'CRF,Preset,Time (Secs),Size (MB)' >> "$datafile"
@r-aamir
r-aamir / nginx-csp-security.conf
Created October 14, 2021 12:54 — forked from mikeg-de/nginx-csp-security.conf
CSP definition for Nginx which leverages $server_name
# CSP definition for Nginx which leverages $server_name
# Purpose: One CSP-Header for all vhosts
# Installation
# Include this into each server directive in the nginx.conf
# Note
# Check out the script to send a Google Analytics Event and Email upon CSP violation is triggered
# https://github.com/mikeg-de/CSP-Violation-Google-Analytics-Email
@r-aamir
r-aamir / CSP.md
Created October 14, 2021 12:49 — forked from corburn/CSP.md
Nginx server notes

The following is from scotthelme.co.uk

Content Security Policy

with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), you can tell the browser that it can only download content from the domains you explicitly allow http://www.html5rocks.com/en/tutorials/security/content-security-policy/ https://www.owasp.org/index.php/Content_Security_Policy I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval'

@r-aamir
r-aamir / le2018.md
Created August 30, 2021 01:04 — forked from someburner/le2018.md
Let's Encrypt + wildcards for Nginx (Ubuntu 17.10, IPv6, HTTP/2, Proxy-Pass, SLL Rating=A)

Let's Encrypt for Nginx on Ubuntu 17.10, 18.04 with wildcards

Guide info:

  • we're setting up mydomain.com, *.mydomain.com
  • HTML is served from /var/www/mydomain
  • Challenges are served from /var/www/letsencrypt.
  • As of this writing, SSL Labs gives it an A+
  • Took info from here and here on wilcard certs.

Auto-renewal

@r-aamir
r-aamir / amazon-linux2-userdata
Created August 3, 2021 18:25 — forked from Ammly/amazon-linux2-userdata
Amazon Linux 2 Laravel, Nginx, PHP7.4, Mariadb Userdata
#!/bin/sh
sudo yum update -y
sudo amazon-linux-extras install nginx1 php7.4 -y
sudo yum clean metadata
sudo yum install git mariadb-server php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip} -y
# Back up existing config
sudo cp -R /etc/nginx /etc/nginx-backup
sudo chmod -R 777 /var/log
sudo chown -R ec2-user:ec2-user /usr/share/nginx/html
echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/index.php
@r-aamir
r-aamir / webpack.config.js
Created July 13, 2019 21:12 — forked from dkarandana/webpack.config.js
Webpack Config
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const EntryList = require('./weback.entrylist');
const IS_PROD = (process.env.NODE_ENV === 'prod') ? true : false;
/* output path */
const OUT_DIR_ABS = path.resolve('./dist');
@r-aamir
r-aamir / terser.js
Created July 13, 2019 17:03 — forked from jrschumacher/terser.js
A terser script to minify all javascript files in a directory
const fs = require('fs')
const {sync: globSync} = require('glob')
const filesize = require('filesize')
const Terser = require('terser')
const options = require(process.env.TERSER_CONFIG || './terserrc.json')
const getSize = (file) => {
const {size} = fs.statSync(file)
return filesize(size)
}