Skip to content

Instantly share code, notes, and snippets.

@amanjuman
amanjuman / Comple Installation OpenCart with Nginx and Let's Encrypt on Ubuntu 18.04
Created October 13, 2020 10:49
Comple Installation OpenCart with Nginx and Let's Encrypt on Ubuntu 18.04
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:certbot/certbot -y
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get autoremove -y
sudo apt-get install nginx python3-certbot-nginx mariadb-server php7.4-common php7.4-cli php7.4-fpm php7.4-opcache php7.4-gd php7.4-mysql php7.4-curl php7.4-intl php7.4-xsl php7.4-mbstring php7.4-zip php7.4-bcmath php7.4-soap unzip git -y
sudo update-alternatives --set php /usr/bin/php7.4
sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.4/fpm/php.ini
sudo sed -i 's/max_execution_time = 30/max_execution_time = 120/g' /etc/php/7.4/fpm/php.ini
@sinbad
sinbad / backup_gitea.sh
Created August 9, 2020 14:58
My Gitea Backup & Restore Scripts
#!/bin/bash
# `gitea dump` doesn't currently back up LFS data as well, only git repos
# It primarily backs up the SQL DB, and also the config / logs
# We'll backup like this:
# * "gitea dump" to backup the DB and config etc
# * tar / bzip all the repos since they will be skipped
# * Not rotated because git data is immutable (normally) so has all data
# * rsync LFS data directly from /volume/docker/gitea/git/lfs
# * No need for rotation since all files are immutable
@je8n
je8n / gist:61f2bff129c979465c3002f27fe2f8c8
Created January 22, 2019 13:39
CKEditor5 Image Upload.php
//php
if(isset($_FILES["upload"])){
$ext = ".".end((explode(".", $_FILES["upload"]["name"])));
$filename="test";
$file_public_addr =yourlocaladdr.$filename.$ext;
$success=move_uploaded_file($_FILES["upload"]["tmp_name"],SYS_EXT.$file_public_addr);
if( $success){
$json["uploaded"]=true;
@marharyta
marharyta / reboot.css
Last active December 12, 2023 13:46
Reboot CSS
/*
Reboot
Normalization of HTML elements, manually forked from Normalize.css to remove styles targeting irrelevant browsers while applying new styles.
Normalize is licensed MIT. https://github.com/necolas/normalize.css
* Bootstrap v4.0.0-beta (https://getbootstrap.com)
* Copyright 2011-2017 The Bootstrap Authors
* Copyright 2011-2017 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*
@fians
fians / optimize.php
Created January 3, 2018 10:24
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active May 5, 2024 06:11
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@williankeller
williankeller / amp-converter.php
Last active February 18, 2024 12:46
Convert HTML to AMP
<?php
class AMP {
private $html;
/**
* HtmlToAmp constructor.
*/
public function __construct($htmlContent) {
@v3l0c1r4pt0r
v3l0c1r4pt0r / update-hekko.sh
Last active October 6, 2021 19:48
Script to regenerate Let's Encrypt certificate and update hekko.pl via DirectAdmin and certbot
#!/bin/sh
# Update hekko.pl SSL certificate page automatically with Let's Encrypt cert
# Provide $login and $pass to your environment to disable manual login page
# Outputs will be generated in CWD !
domain='example.com'
chain='chain.crt'
ca='isrgrootx1.pem'
useragent='Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0'
cookiefile='.cookies'
@martincarlin87
martincarlin87 / gulpfile.js
Last active April 15, 2024 07:08
Example gulpfile for PHP, SASS, Watching, Minifying, Optimising, Live Reload and Deploying
var gulp = require('gulp');
var gutil = require('gulp-util');
var argv = require('minimist')(process.argv);
var prompt = require('gulp-prompt');
var rsync = require('gulp-rsync');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync');
var useref = require('gulp-useref');
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active April 23, 2024 23:58 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {