Skip to content

Instantly share code, notes, and snippets.

View kevyworks's full-sized avatar

Kevyworks kevyworks

View GitHub Profile
@kevyworks
kevyworks / gist:be09706b3ee96d8c91074a4f3f1295d2
Created January 3, 2023 16:00 — forked from fj/gist:1597544
Slightly nicer way of writing large files to disk with PHP
// Copy big file from somewhere else
$src_filepath = 'http://example.com/all_the_things.txt'; $src = fopen($src_filepath, 'r');
$tmp_filepath = '...'; $tmp = fopen($tmp_filepath, 'w');
$buffer_size = 1024;
while (!feof($src)) {
$buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks
fwrite($tmp, $buffer); // Write in small chunks
}
@kevyworks
kevyworks / mailhog-install.sh
Created September 19, 2022 02:49 — forked from Caffe1neAdd1ct/mailhog-install.sh
Installation of MailHog on CentOS 7
## Install packages
sudo yum install wget curl vim epel-release
sudo yum install daemonize.x86_64
## Install mailhog
wget https://github.com/mailhog/MailHog/releases/download/v0.2.0/MailHog_linux_amd64
sudo chmod +x MailHog_linux_amd64
sudo chown root:root MailHog_linux_amd64
sudo mv MailHog_linux_amd64 /usr/sbin/mailhog
@kevyworks
kevyworks / SendNotificationEmail.php
Created June 23, 2020 20:31 — forked from faneder/SendNotificationEmail.php
Email notification in laravel
<?php
namespace Eder\Jobs;
use Eder\Jobs\Job;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
@kevyworks
kevyworks / SendNotificationEmail.php
Created June 23, 2020 20:31 — forked from faneder/SendNotificationEmail.php
Email notification in laravel
<?php
namespace Eder\Jobs;
use Eder\Jobs\Job;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
@kevyworks
kevyworks / ubuntu-server-setup-16.04.md
Created January 30, 2020 23:28 — forked from marcuslilja/ubuntu-server-setup-16.04.md
Server setup for Ubuntu 16.04 on Digital Ocean

Server setup for Ubuntu 16.04 on Digital Ocean

The setup installs the following software:

  • Nginx
  • MySQL
  • PHP
  • Node
  • Composer
@kevyworks
kevyworks / mailtrap-helper.js
Created October 10, 2018 07:13 — forked from icebob/LICENSE.md
Mailtrap API helper for NodeJS
"use strict";
var MAILTRAP_API = "xxxxxxxxxxxxxxxxxxxxxxx";
var MAILTRAP_INBOX = 12345;
var _ = require("lodash");
var request = require('request');
var baseURL = "https://mailtrap.io/api/v1/";
var headers = {
@kevyworks
kevyworks / uptimemonitor.sh
Created September 8, 2017 10:33 — forked from sweetmandm/uptimemonitor.sh
Cron job to monitor websites and send an email if the website is down.
#! /bin/sh
# A script to monitor uptime of websites,
# and notify by email if a website is down.
SITES="ADD COMMA-SEPARATED WEBSITES HERE"
EMAILS="ADD COMMA-SEPARATED EMAILS HERE"
for SITE in $(echo $SITES | tr "," " "); do
if [ ! -z "${SITE}" ]; then
RESPONSE=$(curl -s --head $SITE)
if echo $RESPONSE | grep "200 OK" > /dev/null
@kevyworks
kevyworks / jquery.pjax.js
Created July 10, 2017 05:46 — forked from oh-ren/jquery.pjax.js
pjax hacked, so it works with jQuery 3.0
/*!
* Copyright 2012, Chris Wanstrath
* Released under the MIT License
* https://github.com/defunkt/jquery-pjax
*/
(function($){
// When called on a container with a selector, fetches the href with
// ajax into the container or with the data-pjax attribute on the link
@kevyworks
kevyworks / scotchboxphp7.txt
Created November 15, 2016 15:16 — forked from mizner/scotchboxphp7.txt
Scotchbox PHP 7
List of PHP 7 Packages: https://launchpad.net/ubuntu/+source/php7.0
Disclaimer: I get unreliable results when I don't run these commands seperately and in order.
vagrant ssh
sudo apt-get update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.0
sudo apt-get update
@kevyworks
kevyworks / DotNotation.php
Created February 2, 2016 07:03 — forked from antonmedv/DotNotation.php
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*