Skip to content

Instantly share code, notes, and snippets.

@lionslair
lionslair / git_fetch_pull_all_subfolders.sh
Created March 24, 2024 07:47 — forked from mnem/git_fetch_pull_all_subfolders.sh
Simple bash script for fetching and pulling all repos in the executed folder to the latest of the branch they are on
#!/bin/bash
################
# Uncomment if you want the script to always use the scripts
# directory as the folder to look through
#REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPOSITORIES=`pwd`
IFS=$'\n'
@lionslair
lionslair / remove_pulse_inserts.sh
Last active March 21, 2024 01:51
Remove the pulse inserts from sql script
#!/bin/bash
# Check if the script received an argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <sql_file>"
exit 1
fi
# Check if the file exists
if [ ! -f "$1" ]; then
@lionslair
lionslair / australian-postcodes.sql
Created February 20, 2024 07:28 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@lionslair
lionslair / formatBytes.js
Created February 6, 2023 04:27 — forked from zentala/formatBytes.js
Convert size in bytes to human readable format (JavaScript)
function formatBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Usage:
@lionslair
lionslair / pint.yml
Created June 29, 2022 00:18
laravel pint ci example
name: My workflow
on: [push]
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
@lionslair
lionslair / Update remote repo
Created April 13, 2022 07:39 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@lionslair
lionslair / .eslintrc.js
Created February 7, 2022 00:08
eslint rules
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
"plugin:vue/base",
"plugin:vue/essential",
"plugin:vue/strongly-recommended",
"plugin:vue/recommended",
//"prettier/vue"
],
@lionslair
lionslair / mysql_backup.config
Created January 26, 2022 06:56 — forked from mrofi/mysql_backup.config
Bash Script to backup all MySQL databases
[client]
user = "mysql_user"
password = "mysql_password"
host = "localhost"
@lionslair
lionslair / .php-cs-fixer.php
Created November 21, 2021 06:34 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@lionslair
lionslair / PHP composer tools.md
Created July 10, 2020 03:16 — forked from davebarnwell/PHP composer tools.md
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd