Skip to content

Instantly share code, notes, and snippets.

View joecampo's full-sized avatar
🌔

Joe Campo joecampo

🌔
View GitHub Profile
@joecampo
joecampo / SwapOctaneServer.php
Created December 2, 2022 22:33 — forked from pascalbaljet/SwapOctaneServer.php
Blue-green deployment with Laravel Octane
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Concerns\CallsCommands;
use Illuminate\Support\Facades\Http;
use Laravel\Forge\Forge;
use Laravel\Forge\Resources\Daemon;
@joecampo
joecampo / gist:a94bac3cd40ae131d6f037ea208ac612
Created June 24, 2022 00:25 — forked from knu/gist:111055
How to mass-rename tags and push them with Git
# Rename tags named foo-bar-#.#.# to v#.#.# and push the tag changes
git tag -l | while read t; do n="v${t##*-}"; git tag $n $t; git push --tags ; git tag -d $t; git push origin :refs/tags/$t ; done
<?php
Builder::macro('deferredPaginate', function ($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) {
$model = $this->newModelInstance();
$key = $model->getKeyName();
$table = $model->getTable();
$paginator = $this->clone()
// We don't need them for this query, they'll remain
// on the query that actually gets the records.
@joecampo
joecampo / tsconfig.json
Created August 12, 2021 18:16 — forked from thecrypticace/tsconfig.json
Laravel Mix config for Vue 3 compat build
// If you're using typescript or ts-check you can alias the composition api package as well:
{
"compilerOptions": {
// … other stuff omitted for brevity …
// Ensure your base url is set
"baseUrl": ".",
"paths": {
// Add composition API to your compiler options and alias it to the vue 3 install
// The path is relative to `baseUrl` above
#!/bin/bash
xset s noblank
xset s off
xset -dpms
unclutter -idle 0.5 -root &
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences
@joecampo
joecampo / install_pdo_sqlsrv.sh
Last active May 25, 2023 00:14
Install Official MSSQL driver for Unbuntu 14.04 - pdo_sqlsrv
#!/bin/bash
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo -i export CPPFLAGS="-DSIZEOF_LONG_INT=8"
sudo apt-get -y install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
cd ~
echo "Configuring the unixODBC 2.3.1 Driver Manager"

Keybase proof

I hereby claim:

  • I am joecampo on github.
  • I am joecampo (https://keybase.io/joecampo) on keybase.
  • I have a public key whose fingerprint is BE87 7907 C11D EA45 7120 8144 ABC0 6655 C6EC 6C65

To claim this, I am signing this object:

@joecampo
joecampo / fail2ban.md
Last active November 6, 2024 10:14
fail2ban – stop HTTP(S) route abuse/brute forcing

If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.

Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,

@joecampo
joecampo / Connecting PHP 5.6 to MSSQL.md
Last active June 4, 2022 14:20
Connecting PHP 5.6 to MSSQL - Ubuntu (Debian) w/ Apache