Skip to content

Instantly share code, notes, and snippets.

View xorenio's full-sized avatar
🚀
Minimal code, Maximum effort

John J xorenio

🚀
Minimal code, Maximum effort
View GitHub Profile
@xorenio
xorenio / laravel.sh
Last active October 18, 2015 00:18
Quick light bash script for installing laravel
#!/bin/bash
# Get current dir
DIR=$(pwd)
# echo it out to make sure user is in the right place
echo $DIR
# What do you want to install 4.2 or latest
read -p "Laravel? 4.2 or Latest ? (1/2) " -n 1 -r && echo ""
if [[ $REPLY =~ ^[1]$ || ! $REPLY ]]; then
@xorenio
xorenio / zip.sh
Last active October 18, 2015 00:15
BASH: Check for zips in directories
#!/bin/bash
# This script makes zips of dirs in current dir if there is no zips in the dir
echo "" #Insert a break before any output
for D in *; do
if [ -d "${D}" ]; then # Check if dir
zip="$(echo $D | tr '[A-Z]' '[a-z]')" # Place letters with over cases
if [ -f "${D}/${zip}.zip" ]; then # Check to if there is a zip in the folder
# echo "found ${D}/${zip}.zip" # Tell users
@xorenio
xorenio / fix_web_perms.sh
Last active April 5, 2018 18:04
Fixing all the file perm on a website
#!/bin/sh
echo "Fixing perissions for files and folders."
find . -type f -name '*.php' -exec chmod 600 {} \;
find . -type f -name '*.html' -exec chmod 644 {} \;
find . -type f -name '*.htm' -exec chmod 644 {} \;
find . -type f -name '*.xml' -exec chmod 600 {} \;
find . -type f -name '*.css' -exec chmod 755 {} \;
find . -type f -name '*.less' -exec chmod 644 {} \;
find . -type f -name '*.js' -exec chmod 644 {} \;
@xorenio
xorenio / Ubuntu apt fix
Created February 12, 2016 10:47
This bash script fixes the problem on fresh installs of ubuntu 12.04 installed as a VM on Proxmox, VMware or any container host. On fresh install apt is broken I have mainly seen this problem when installing VMs on OVH
#!/bin/bash
rm /var/lib/apt/lists/* -vf
apt-get clean
apt-get -y autoremove
apt-get -y update
apt-get -y dist-upgrade
apt-get clean
cd /var/lib/apt
mv lists lists.old
@xorenio
xorenio / start-mc.sh
Last active March 27, 2017 12:19
Bash script for a minecraft server. (Not finished)
#!/bin/bash
# This is not finished. I made this back in late 2014 and forgot to finish it if you find anything helpful atleast someone got one use out of it
# Quick note this will make a screen and the screen will be named after the folder where this bash script has been excuted from
# What jar
# The jar usaged to start the server
jar="*.jar"
@xorenio
xorenio / check.sh
Created February 24, 2017 10:28
Bash available space check
#!/bin/bash
# for file sizes
# 19456000 = 19GB
# Random find on hard drive might not work
SPACE= df -P . | tail -1 | awk 'CHECK=$4';
S=df -P $PWD | awk 'NR==2{print $4}'
@xorenio
xorenio / birthdaylist.php
Created March 14, 2017 01:20
Laravel birthday list from date of birth
<?php
$thisDayNo = Carbon::now()->day;
$thisMonthNo = Carbon::today()->month;
$nextMonthNo = $thisMonthNo+1;
if($nextMonthNo > 12)
$nextMonthNo = 1;
$ClientBirthday = Client::whereNull('serviceEndDate') // make sure their still in contract
@xorenio
xorenio / idle-monitor.js
Last active March 20, 2017 16:16
built in Laravel using sweetalert2 idle monitor with prompt for password on session time out.
// set timeout
var tid = setTimeout(idleCheck, 5000);
function idleCheck() {
$.ajaxSetup({
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
$.ajax({
type: "post",
@xorenio
xorenio / relations-checks.php
Created March 24, 2017 15:31
laravel oem query relations
<?php
// where has relation and key - value
// OR
// doesnt have a relation
->where(function($query){
$query->whereHas('report', function($q){$q->where('accepted', '<=', '0');})
->orWhereHas('report', function($q){$q;}, '<', 1);
})
@xorenio
xorenio / screen-fix.sh
Created March 27, 2017 15:00
Fix for screen issue when changing user on linux term
#!/bin/bash
## I need a way of checking if screen issue
# To re-create the issue simply su a user
###
# root@local:~# sudo su john
# john@local:/root$ screen -l
#ISSUE-> Cannot open your terminal '/dev/pts/0' - please check.