Skip to content

Instantly share code, notes, and snippets.

View homiedopie's full-sized avatar
🎯
Focusing

Michael Mantos homiedopie

🎯
Focusing
View GitHub Profile
<?php
namespace App\Traits;
use App\Exceptions\MinimumLegalAgeNotMetException;
use Illuminate\Support\Carbon;
trait ShouldBeAtLegalAge
{
/**
<?
// this script receives a Stripe dispute / chargeback and:
//
// - immediately refunds the payment
// - closes the user's account (in my DB, add your own code there)
//
// this is to automate dispute handling (because you never win a dispute on Stripe anyway)
// and by refunding avoiding the chargeback fee
//
@jakebathman
jakebathman / logslaravel.sh
Created August 19, 2018 00:06
Tail Laravel logs and filter out the stack traces
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
@muratgozel
muratgozel / composer-setup.sh
Created April 10, 2018 20:55
Composer setup shell script.
#!/bin/sh
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
sudo rm composer-setup.php
@BretFisher
BretFisher / docker-for-windows.md
Last active August 6, 2024 18:02
Getting a Shell in the Docker for Windows Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your CLI and it'll drop you in a container with full permissions on the Moby VM. Only works for Moby Linux VM (doesn't work for Windows Containers). Note this also works on Docker for Mac.

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1

@mazedlx
mazedlx / how_to_install_oci8_on_ubuntu_17.10_and_PHP_7.1.md
Last active February 21, 2024 10:05
How to install OCI8 on Ubuntu 17.10 and PHP 7.1

How to install OCI8 on Ubuntu 17.10 and PHP 7.1

This guide refers to Instantclient Version 12.2.0.1.0

Install Oracle Instant Client and SDK

Step 1

Download the latest Oracle Instant Client and SDK from the Oracle website (Yeah, fuck you Oracle, you need to create an account to download the files).

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

@thonly
thonly / async_function.js
Last active August 9, 2019 12:36
Async/Await "Polyfill"
async = generator => {
const g = generator();
(function next(value) {
const n = g.next(value);
if (n.done) return;
n.value.then(next);
}());
}
@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS.md
Last active January 26, 2026 14:59
Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

@crittermike
crittermike / wget.sh
Last active March 12, 2026 20:31
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@martinkuba
martinkuba / example-consumer-1.js
Created August 17, 2017 19:35
New Relic Node Agent - message instrumentation examples
// This example shows using custom instrumentation function.
// The kafka module is instrumented in a central place, separately from the app
// that uses it.
const newrelic = require('newrelic')
const instrumentKafkaClient = require('./kafka-client-instrumentation')
// register instrumentation for the kafka client module
newrelic.instrumentMessages('./mock-kafka-client', instrumentKafkaClient,
function handleError(err) {
// this is called when the instrumentation itself errors