Skip to content

Instantly share code, notes, and snippets.

View rheinardkorf's full-sized avatar

Rheinard Korf rheinardkorf

View GitHub Profile
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 22, 2024 08:47
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@carlalexander
carlalexander / expect-header-fix.php
Last active August 13, 2021 00:40
WordPress "Expect" header fix
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = '';
<?php
/*
Plugin Name: WPS Custom Block Patterns
Description: Adds a custom block pattern to the Gutenberg block editor.
Version: 1.0
Author: Chris Romero
Author URI: https://cromero.io
*/
@zevdg
zevdg / cacheFirstGet.js
Created March 18, 2018 03:14
cache-first getter for firebase references
function cacheFirstGet(ref, handlerFunc, timeout = 10000) {
let options = {};
if (ref instanceof firebase.firestore.DocumentReference) {
options.includeMetadataChanges = true;
} else if (ref instanceof firebase.firestore.Query) {
options.includeQueryMetadataChanges = true;
} else {
throw new Error("Input must implement DocumentReference or Query");
}
<?php
/**
* Whitelist embedded links in the REST API responses
*
* This is often useful if you want to only get specified resources embedded along with the
* main resources, rather than the "all of nothing" approach of passing `?_embed` to the API request.
*
* You can either pass a comma seperated list of relationships or an array of string via the `_embed_include` query param.
*
@joelworsham
joelworsham / gist:ca39eeacace703c368a4
Last active January 11, 2016 00:49
PHP Version Check
<?php
...
if ( version_compare( '5.3', phpversion(), '>' ) ) {
add_action( 'admin_notices', '_myplugin_php_notice' );
// Do what you need to stop your plugin from loading
}
/**
* Displays an admin error about needing to update the server's PHP version.
@bappi-d-great
bappi-d-great / code.php
Created January 22, 2015 15:56
Add custom post type quota for different Pro Sites level
<?php
/*
*
* You just need to configure the $limits array. The elements are level ID - 1. So, if your level ID 1, the index will be 0.
* Then for product index add the limit
*
*/
$limits = array(
'0' => array(
@thde
thde / whois.conf
Last active September 1, 2023 07:29
/etc/whois.conf WHOIS records for nTLDs.
##
# WHOIS servers for new TLDs (http://www.iana.org/domains/root/db)
# Current as of 2017-12-10 UTC
##
\.aarp$ whois.nic.aarp
\.abarth$ whois.afilias-srs.net
\.abbott$ whois.afilias-srs.net
\.abbvie$ whois.afilias-srs.net
\.abc$ whois.nic.abc
@uglyrobot
uglyrobot / package-plugin
Last active September 14, 2017 07:28
A shell script for easy tagging and clean zip packaging of a WordPress Plugin/Theme in git.
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Please enter a version number:"
read VERSION
else
VERSION=$1
fi
if [[ -z "$VERSION" ]] ; then
echo "Sorry, I need a version number!"
@dazld
dazld / perlin.php
Created March 23, 2012 18:59
PHP Perlin Noise Class
//This is a port of Ken Perlin's "Improved Noise"
// http://mrl.nyu.edu/~perlin/noise/
// Originally from http://therandomuniverse.blogspot.com/2007/01/perlin-noise-your-new-best-friend.html
// but the site appears to be down, so here is a mirror of it
class Perlin {
var $p, $permutation, $seed;
var $_default_size = 64;