Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
@progress44
progress44 / downloaded.json
Created September 2, 2020 20:20
Downloading files test script (plain js)
[]
@progress44
progress44 / analytics.conf
Created August 16, 2020 11:25 — forked from jirutka/analytics.conf
Add Google Analytics tracking code to HTML via nginx
#
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-12345678-9';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
@progress44
progress44 / VideoStream.php
Created April 26, 2020 09:54
Php Class that streams video files
<?php
/**
* Description of VideoStream.
*
* @author Rana
*
* @see http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
namespace App\Http;
@progress44
progress44 / S3FileStream.php
Created April 26, 2020 09:47
Laravel response class to handle S3 file stream
<?php
namespace App\Http\Responses;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class S3FileStream
{
/**
@progress44
progress44 / wp_config.php
Last active October 12, 2019 08:21 — forked from butlerblog/wp_config.php
Configure WordPress wp_mail function to send through SMTP server http://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php
* These should be added somewhere BEFORE the
* constant ABSPATH is defined.
*/
define( 'SMTP_USER', '[email protected]' ); // Username to use for SMTP authentication
define( 'SMTP_PASS', 'smtp password' ); // Password to use for SMTP authentication
@progress44
progress44 / loop.sh
Created August 8, 2019 13:02
Clean docker logs if docker is misconfigured
#!/bin/bash
DIR=/var/lib/docker/containers
FILES=$(ls $DIR)
for f in $FILES
do
echo "Processing $f dir..."
# take action on each file. $f store current file name
ls -lash $DIR/$f | grep .log
LOGS=$(ls $DIR/$f/ | grep .log)
@progress44
progress44 / index.js
Created August 6, 2019 12:33 — forked from vinzdef/index.js
Fork Process in Cluster
const server = require('./server.js')
const numCPUs = require('os').cpus().length
const cluster = require('cluster')
function makeCluster() {
return new Promise((resolve, reject) => {
if (cluster.isMaster) {
for (let i = 0; i < numCPUs; i++) {
cluster.fork()
}
@progress44
progress44 / daemon.json
Created August 4, 2019 22:55
Cleaning docker logs if it's not configured correctly
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3",
"labels": "production_status",
"env": "os,customer"
}
}
@progress44
progress44 / createCat.php
Created May 24, 2019 22:32 — forked from harshvardhanmalpani/createCat.php
How to create Magento 2 category programmatically
<?php
//creating categories in magento 2
//last verified Magento 2.2.0 27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=2,$c=true,$d='',$e='',$f='',$g='') {
global $objectManager;
@progress44
progress44 / Ingress-controller-tls.md
Created May 6, 2019 23:21
Guide from jetstack to configure ingress-controller and letsencrypt

================================================= Quick-Start using Cert-Manager with NGINX Ingress

Step 0 - Install Helm Client

Skip this section if you have helm installed.

The easiest way to install cert-manager is to use Helm_, a templating and