Skip to content

Instantly share code, notes, and snippets.

View marlocorridor's full-sized avatar
🏠
Working from home

mcorridor marlocorridor

🏠
Working from home
View GitHub Profile
@marlocorridor
marlocorridor / query.php
Created February 17, 2023 01:00
Laravel Raw DB query whereIn equivalent on JSON column
<?
DB::table('transactions')
->select(
'id',
DB::raw('meta->"$.target_units" as target_units'),
DB::raw('"9864a4b0-ac8a-43bc-a8cf-c10c6e2da09c" MEMBER OF(meta->"$.target_units") as hit')
)
->where('hit', true)
->get();
@marlocorridor
marlocorridor / install-ssl-apache.md
Created June 12, 2020 06:50 — forked from ccschmitz/install-ssl-apache.md
How to install an SSL certificate on an Apache server.

Installing an SSL certificate on Apache

  1. Create a private key:
openssl genrsa 2048 > private-key.pem
  1. Create a Certificate Signing Request (CSR):
@marlocorridor
marlocorridor / laravel-production-permissions.md
Created June 10, 2020 18:53 — forked from barbietunnie/laravel-production-permissions.md
MySQL Database User GRANT permissions for Laravel

MySQL Database User GRANT permissions for Laravel

For security reasons, you should probably grant select, delete, update and insert to your app user in production.

Have another user who can do alter, create, drop and index when running migrations.

If you run seeders in production, also grant select, insert and references to the migration user.

Yeah, 2 users, migrations are not always run in production everyday and this keeps more secure your database.

@marlocorridor
marlocorridor / key-fingerprint
Created June 10, 2020 03:36 — forked from yosemitebandit/key-fingerprint
view your ssh public key's fingerprint; compare this to what Github has listed in the ssh key audit
$ ssh-keygen -l -f /path/to/keys/id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
@marlocorridor
marlocorridor / gist:c4d8417f2fc58c3fb866e0a6f94354fb
Last active June 19, 2018 04:04 — forked from jordelver/gist:3139365
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0

1: EFI 209.7 MB disk0s1

#!/bin/bash
# Creator: Phil Cook
# Email: [email protected]
# Twitter: @p_cook
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.6","7.0","7.1","7.2")
php_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]")
valet_support_php_version_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]")
php_installed_array=()
@marlocorridor
marlocorridor / pyramid.js
Last active May 3, 2018 04:35
Pyramid test
function space_front(size, n) {
return size - n;
}
function space_mid(n) {
return (2 * n) - 3;
}
function is_top(n) {
return n > 1;
@marlocorridor
marlocorridor / cloudflareWhitelistUpdate.php
Last active April 23, 2018 09:33 — forked from ostark/cloudflareWhitelistUpdate.php
Updates the .htaccess with the recent ClouldFlare IPs
<?php
# Exec during deployment
# php cloudflareWhitelistUpdate.php public/.htaccess
$srcUrls = [
'https://www.cloudflare.com/ips-v4',
'https://www.cloudflare.com/ips-v6'
];
$htacessFile = $argv[1] ?? '.htaccess';
(function () {
// Image decoders (for web workers)
dwv.image.decoderScripts = dicom_extenstions;
// base function to get elements
dwv.gui.getElement = dwv.gui.base.getElement;
dwv.gui.displayProgress = function (percent) {};
// create the dwv app
var app = new dwv.App();
@marlocorridor
marlocorridor / laravel_seeder.sh
Last active December 15, 2016 14:06
Make laravel seeder work properly - solves class not found
# To work something like
# php .\artisan db:seed --class=UsersTableSeeder
# where `UsersTableSeeder` is a newly created class on seeder file
# you need to execute this first
composer dump-autoload
# Reference :)
#http://laravel.io/forum/01-31-2015-laravel5-seeder-reflectionexception-class-tableseeder-does-not-exist-in-illuminatecontainercontainerphp776
# You should never forget, even when it sounds dummy to dump the autoload files with the command "composer dump-autoload" to make the seeders work properly.