Skip to content

Instantly share code, notes, and snippets.

View VirtusB's full-sized avatar

Virtus B. Opstrup VirtusB

View GitHub Profile
@webhouse-dev
webhouse-dev / Cloudlinux Redix via Unix socket.md
Last active November 14, 2024 15:10
Redis via Unix socket on CloudLinux with CageFS

It's not a secret that Redis service is a really great backend caching service. Normally people use that via TCP. It's fast and reliable. However if you do benchmark via unixsocket you will see that it will double amount of requests per second (of course depend on your server but much much faster than TCP). Redis via unixsocket is the best setup to go... however people using CageFS in Cloudlinux will struggle with permissions and they won't be able to connect to unixsocket. Here is the solution!

Step 1: change redis config to use unixsocket (still keeping TCP). In /etc/redis.conf uncomment and change lines:

# Unix socket.
#
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
@DannyvdSluijs
DannyvdSluijs / automaker-plus.php
Last active May 28, 2020 11:19
Map Bitstamp using automaker plus
<?php
use App\TradingPair;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use AutoMapperPlus\Configuration\AutoMapperConfig;
use AutoMapperPlus\AutoMapper;
use AutoMapperPlus\NameConverter\NamingConvention\CamelCaseNamingConvention;
use AutoMapperPlus\NameConverter\NamingConvention\SnakeCaseNamingConvention;
@divinity76
divinity76 / misc PHP.php
Last active June 18, 2025 20:12
misc PHP copypasta pasta
<?php
// find . -iname "*.php" -print0 | xargs -0 --max-args=1 --max-procs=$(nproc) '-I{}' sh -c 'php --syntax-check {} || true' | grep --invert-match "^No syntax errors detected in"
function json_encode_pretty($data, int $extra_flags = 0, int $exclude_flags = 0): string
{
// prettiest flags for: 7.3.9
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | (defined("JSON_UNESCAPED_LINE_TERMINATORS") ? JSON_UNESCAPED_LINE_TERMINATORS : 0) | JSON_PRESERVE_ZERO_FRACTION | (defined("JSON_THROW_ON_ERROR") ? JSON_THROW_ON_ERROR : 0);
$flags = ($flags | $extra_flags) & ~ $exclude_flags;
return (json_encode($data, $flags));
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
sudo brew services restart php71
echo "xdebug disabled"
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active September 27, 2025 02:50
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :