Skip to content

Instantly share code, notes, and snippets.

View detain's full-sized avatar
💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]

Joe Huss detain

💯
Da Vinci of Linux, Van Gogh of Code, [self proclaimed, but legit]
View GitHub Profile
@detain
detain / bash_shopt.md
Created May 4, 2024 00:09
BASH (shopt) Shell Options Explained

Bash Shel Options ( shopt ) Explained

I wasted time WTFM so RTFM

Enable OptionDisable OptionList Enabled OptionsEnabled Options Sample Output
shopt -s <opt>
shopt -u <opt>
echo $BASHOPTS
checkwinsize:cmdhist:complete_fullquote

This table illustrates the behavior of various shopt options in bash. By toggling these options, you can influence how the shell handles things like filename completion, history management, and error handling.

Option Description Disabled Enabled Example
@detain
detain / mame.md
Last active July 2, 2024 20:09
MAME Notes on Setup with Multimedia/EXTRAs and mameinfo/highscores/history/etc

MAME

Setting up MAME

Create the ini files with the appropriate command:

mame -createconfig
@detain
detain / check_errors.sh
Created August 16, 2023 18:09
Run tsc/vue-tsc converting the output to brief/easy to read JSON
#!/bin/bash
npm i -g @aivenio/tsc-output-parser;
echo "Running vue-tsc and parsing output into errors.json";
npx vue-tsc --strict --noEmit | npx tsc-output-parser > errors.json;
echo "remapping errors.json";
echo '<?php
$errors = [];
$jsonOpts = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
$json = json_decode(file_get_contents("errors.json"),true);
foreach ($json as $row) {
@detain
detain / README.md
Created June 29, 2022 13:44
Register editor:// URL handler to open your fav text editor

How to setup the editor:// URL Handler

  • copy the open-in-editor.js and register editor handler.cmd somewhere on your system. (They must be in the same directory)
  • edit the open-in-editor.js and uncomment the editor you use commenting the other out
  • change the mappings lines around to rewrite the remote filename paths into the path your editor will expect
  • run the register editor handler.cmd (You must reload any existing browser tabs before it will work in them)
@detain
detain / set_genre_by_artist_genre_frequency.php
Last active February 29, 2020 23:37
Recursivly Iterates a directory finding MP3s and then loading the ID3 info via 'mediainfo' for each. it then builds a list of genre popularity by artist (how many songs for each artist use which genre) working with genre beingset to multiple genres and split with either a semicolon (;) or foreslash (/)
<?php
/**
* Recursivly Iterates a directory finding MP3s and then loading the ID3 info via 'mediainfo' for each.
* it then builds a list of genre popularity by artist (how many songs for each artist use which genre)
* working with genre beingset to multiple genres and split with either a semicolon (;) or foreslash (/)
*
* - Automatic Backups every 120 seconds (configurable)
* @see $backupSeconds
* - Intelligent Reprocessing of MP3s only updating when the "Last Modified Time" is newer than what we stored in the db
* - Commands Optimization drastically cutting back on the number of times "mediainfo" is ran
@franksacco
franksacco / session-handler-life-cycle.md
Last active August 23, 2024 12:44
A complete overview of PHP session handler life cycle

A complete overview of PHP session handler life cycle

The purpose of this document is to provide a complete overview of the PHP session handler life cycle updated to version 7.0 or above. In particular, I want to emphasize what methods and in what order are called when the native PHP functions are used for session management.
I created this document because the information on the web and the official documentation are very superficial on this topic, in particular on what concerns the implementation of a safe and stable session handler.

@stojg
stojg / gist:456d733015c6449b0dd1
Last active August 29, 2015 14:16
Speed up vagrant networking by a gazillion
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
end

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for live environment!

I hope it's a help also for you!

#Installation stack

@ck-on
ck-on / ocp.php
Last active September 5, 2024 01:35
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter