Skip to content

Instantly share code, notes, and snippets.

@jakebathman
jakebathman / remove_laravel_comments.php
Last active February 19, 2024 10:28
Remove comments from fresh Laravel files
<?php
/*
|--------------------------------------------------------------------------
| Remove Laravel Comments
|--------------------------------------------------------------------------
|
| Just made a new Laravel project, but don't want all those big
| comment blocks? Put this in the root of your project and run
| "php remove_laravel_comments.php"
|
@jakebathman
jakebathman / StateBoundaries.sql
Last active February 12, 2024 00:14
The approximate max/min latitude and longitude for all states and major territories
-- Create the table
CREATE TABLE IF NOT EXISTS `StateBoundaries` (
`State` varchar(10) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
`MinLat` varchar(50) DEFAULT NULL,
`MaxLat` varchar(50) DEFAULT NULL,
`MinLon` varchar(50) DEFAULT NULL,
`MaxLon` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@jakebathman
jakebathman / logslaravel.sh
Created August 19, 2018 00:06
Tail Laravel logs and filter out the stack traces
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
@jakebathman
jakebathman / icd_regex.md
Last active October 12, 2023 09:31
ICD-9 and ICD-10 code regex

ICD code matching regex

The regex patterns below only help validate when something is not valid ICD-10 or ICD-9. They do not ensure that the code exists. You should consult a list of valid ICD codes for that level of verification.

ICD-10-CM list: https://gist.github.com/jakebathman/063c50cb9772e4bfc864a9e1ff4ccc8d

ICD-9 list: https://gist.github.com/jakebathman/f1ed0d473f12091a708243b0ddf03d82

ICD-10/ICD-9 combined regex

Useful for validating field values that could contain both, and may or may not use decimals

@jakebathman
jakebathman / icd-9-cm.txt
Last active October 12, 2023 09:31
ICD-9-CM code list
0010
0011
0019
0020
0021
0022
0023
0029
0030
0031
@jakebathman
jakebathman / jsonToCsv.php
Last active June 5, 2022 21:02 — forked from Kostanos/json-to-csv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
@jakebathman
jakebathman / is_backblaze_uploading.sh
Created February 15, 2018 20:25
Determine if Backblaze is currently backing up files on macOS
#!/bin/sh
# This will look at the overviewstatus.xml file and
# determine if Backblaze is currently transmitting a file.
#
# Developed against:
# macOS 10.13.3
# Backblaze 5.2.0.172
BBSTATUS='/Library/Backblaze.bzpkg/bzdata/overviewstatus.xml'
@jakebathman
jakebathman / func.php
Created May 16, 2022 19:21
How long can a PHP function name be?
<?php
// How long can a function name in PHP get?
$alpha = 'abcdefghijklmnopqrstuvwxyz';
// Note: PHP will run out of memory if you make this range too large
for ($i = 1; $i <= 10000; $i++) {
$name = str_pad('', $i, $alpha);
$count = strlen($name);
@jakebathman
jakebathman / meili.php
Created May 4, 2022 19:58
Quick summary of Meilisearch batch indexing progress
<?php
$tasks = json_decode(file_get_contents('http://127.0.0.1:7700/indexes/standards/tasks'), true);
$durations = [];
$batches = [];
$batchDocs = [];
foreach ($tasks['results'] as $task) {
$uid = $task['uid'];
@jakebathman
jakebathman / provision_irc_server.sh
Last active September 19, 2021 16:53
IRC server setup on CentOS 7
#!/bin/bash
# This sets the variable $IPADDR to the IP address the new Linode receives.
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
sudo yum update -y
sudo yum install nginx wget git -y
cd ~