Skip to content

Instantly share code, notes, and snippets.

Avatar
🌔

Joe Campo joecampo

🌔
View GitHub Profile
@joecampo
joecampo / gist:a94bac3cd40ae131d6f037ea208ac612
Created Jun 24, 2022 — forked from knu/gist:111055
How to mass-rename tags and push them with Git
View gist:a94bac3cd40ae131d6f037ea208ac612
# 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
View deferredPaginate.php
<?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 Aug 12, 2021 — forked from thecrypticace/tsconfig.json
Laravel Mix config for Vue 3 compat build
View tsconfig.json
// 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
View gist:ebb0ea704f72322114ae4b5a425b8361
#!/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 Jul 3, 2020
Install Official MSSQL driver for Unbuntu 14.04 - pdo_sqlsrv
View install_pdo_sqlsrv.sh
#!/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"
View keybase.md

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 Dec 15, 2021
fail2ban – stop HTTP(S) route abuse/brute forcing
View fail2ban.md

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 Jun 4, 2022
Connecting PHP 5.6 to MSSQL - Ubuntu (Debian) w/ Apache
View Connecting PHP 5.6 to MSSQL.md