Skip to content

Instantly share code, notes, and snippets.

View mcjwsk's full-sized avatar

Dariusz Maciejewski mcjwsk

View GitHub Profile
@etdev
etdev / algolia_cache_proxy_for_cloudflare.js
Last active March 24, 2025 09:00
Algolia cache proxy - Cloudflare worker
const ALGOLIA_APP_ID = "<your algolia app id>";
addEventListener('fetch', event => {
try {
const request = event.request;
if (request.method.toUpperCase() === 'POST') return event.respondWith(handlePostRequest(event));
return handleRequest(request);
} catch (e) {
return event.respondWith(new Response('Error thrown ' + e.message));
}
@vikas5914
vikas5914 / build.sh
Last active August 7, 2024 13:00
Build Static Mozjpeg 4 on Debian Ubuntu Mint
#!/bin/sh
set -e
# Script was created from https://github.com/a-vrma 's docker script.
# Ref: https://github.com/imagemin/mozjpeg-bin/pull/57
sudo apt-get update -y
sudo apt-get install -y build-essential nasm cmake ninja-build curl libpng-dev libpng-tools zlib1g-dev
mozjpeg_version=4.1.1
@piotrekkaminski
piotrekkaminski / MPERF-10565.diff
Created April 8, 2019 18:04
MPERF-10565.diff - logging to a file that does not exist issue
diff --git a/app/Mage.php b/app/Mage.php
index 0e650eebb4f..9c18e222689 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -798,9 +798,9 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
',',
(string) self::getConfig()->getNode('dev/log/allowedFileExtensions', Mage_Core_Model_Store::DEFAULT_CODE)
);
- $logValidator = new Zend_Validate_File_Extension($_allowedFileExtensions);
$logDir = self::getBaseDir('var') . DS . 'log';
@nicksantamaria
nicksantamaria / fork-example.php
Created October 20, 2016 22:35
Example: Parallel processing in PHP using pcntl_fork()
<?php
/**
* @file
* Basic demonstration of how to do parallel threads in PHP.
*/
// This array of "tasks" could be anything. For demonstration purposes
// these are just strings, but they could be a callback, class or
// include file (hell, even code-as-a-string to pass to eval()).
@petemcw
petemcw / brew-instructions.sh
Last active May 7, 2025 12:01
Setup dnsmasq on Mac OS X
# Install `dnsmasq` and configure for *.test domains
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Reload configuration and clear cache
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
$ dscacheutil -flushcache
@pablete
pablete / .bash_profile
Last active March 28, 2022 14:03 — forked from porras/.bash_profile
Change iTerm2 profile (ie: background color) when SSHing into another machine
# Changing iTerm2 color in MacOSX when SSHing (so you know at a glance that you're no longer in Kansas)
# Adapted from https://gist.github.com/porras/5856906
# 1. Create a theme in your terminal setting with the name "SSH" and the desired colors, background, etc.
# 2. Add this to your .bash_profile (or .bashrc, I always forget the difference ;))
# 3. Optional but useful: in the terminal, go to Settings > Startup and set "New tabs open with" to
# "default settings" (otherwise, if you open a new tab from the changed one, you get a local tab with
# the SSH colors)
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi # if you have trouble with this, change