View llama2-mac-gpu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clone llama.cpp | |
git clone https://github.com/ggerganov/llama.cpp.git | |
cd llama.cpp | |
# Build it | |
LLAMA_METAL=1 make | |
# Download model | |
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin | |
wget "https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/resolve/main/${MODEL}" |
View neovim_install_amazonlinux2.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Same as https://github.com/neovim/neovim/wiki/Installing-Neovim#centos-8--rhel-8 | |
# but requires EPEL 7, not 8. | |
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
yum install -y neovim python3-neovim |
View theme.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @theme rk */ | |
@import 'default'; | |
h1, h2, h3 { | |
color: #ffffff; | |
} | |
section { | |
background-image: linear-gradient(to bottom, #67b8e3, #0288d1); |
View quick_image_to_base64.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function image_to_base64( $image, $type = 'image/jpeg' ) { | |
// Use new buffer to grab the output. | |
ob_start(); | |
switch ( $type ) { | |
case 'image/jpeg': | |
imagejpeg( $image ); | |
break; |
View acf-hooks-basic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hook before acf_get_value() queries the DB. | |
*/ | |
add_filter( | |
'acf/pre_load_value', | |
function( $meta, $object_id, $field ) { | |
// Initiate the ACF 'values' store. |
View acf-hooks.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This file contains some hooks to improve ACF performance. | |
* | |
* @package rheinardkorf | |
*/ | |
add_filter( | |
'acf/pre_load_value', | |
function( $meta, $post_id, $field ) { |
View queries.mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a particular option entry. | |
SELECT * FROM wp_options WHERE option_name="<OPTION_NAME>" LIMIT 1000; | |
# Make sure an option to not autoloaded. | |
UPDATE wp_options SET autoload = 'no' WHERE option_name="<OPTION_NAME>"; | |
# Get the size of total autoladed values. | |
SELECT SUM(LENGTH(option_value)) as autoload_size FROM wp_options WHERE autoload='yes'; | |
# Get the top 10 most "expensive" autoloaded values. |
View cache-example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This example assumes an object cache is available. If its not, transients WITHOUT EXPIRATION will be used. | |
$cache_key = 'unique_prefix_' . md5( $variables ); | |
$results = wp_cache_get( $cache_key ); | |
if ( false === $results ) { | |
$results = $wpdb->get_var( $wpdb->prepare("SQL STATEMENT HERE", $variables['here'], $variables['etc'] )); | |
wp_cache_set( $cache_key, $results ); | |
} |
View .mermaidrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"sequence":{ | |
"diagramMarginY" :10, | |
"diagramMarginX" :50, | |
"actorMargin" :50, | |
"width" :150, | |
"height" :65, | |
"boxMargin" :10, | |
"boxTextMargin" :5, | |
"noteMargin" :10, |
View .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*~ | |
.DS_Store | |
.svn | |
.cvs | |
*.bak | |
*.swp | |
Thumbs.db | |
# wordpress specific | |
wp-config.php |
NewerOlder