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
#!/bin/bash | |
input_image="full.jpg" | |
output_prefix="part_" | |
max_width=3840 | |
max_height=2160 | |
aspect_ratio=$(bc -l <<< "$max_width / $max_height") | |
# Get image dimensions | |
dimensions=$(identify -ping -format "%w %h" "$input_image") |
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
(ns woodoo-pos-sync\lib\odoo | |
(:require phel\str :as str) | |
(:require woodoo-pos-sync\lib\wp :as wp) | |
(:use \Laminas\XmlRpc\Client)) | |
### Wrapper for Laminas XMLRPC library and Odoo XMLRPC-API | |
## Docs: | |
## - https://docs.laminas.dev/laminas-xmlrpc/client/ | |
## - https://www.odoo.com/documentation/18.0/developer/reference/external_api.html |
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
# Option map validation taking some inspiration from https://github.com/babashka/cli | |
# Validates opts map given in following format: | |
(comment | |
{:pdo-conn | |
{:require true # this should be set | |
:validate 'pdo/connection? # function used for validation, quoted so it's definition can be printed on failure | |
:default |(wp/pdo-get-connection)} # default value used by set-missing-opts-to-defaults, returns pdo connection using WPDB connection info | |
:excluded-barcode-prefixes |
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
# Attempt to fix some surprising PHP behavior inconsistent with Java (Clojure), | |
# for some basic use cases only. | |
(defn parse-float | |
"Converts to float without doing odd type conversions, acting more like | |
Float/parseFloat in Clojure." | |
[x] | |
(when-not (php/is_numeric x) | |
(throw (php/new \InvalidArgumentException | |
(str "Invalid value for parse-float (" x ")")))) |
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
;; "Phel Cider Light" Phel-lang programming config | |
;; Stand-alone preview version separated from from personal .emacs.d | |
;; https://github.com/jasalt/.emacs.d/blob/007083f149cf3954a6f38328c962c6788e179705/personal/phel.el#L1 | |
;; Written during two days during winter cold largely with Claude Sonnet 3.5 LLM | |
;; and gptel.el. While surprisingly good experience for a quick proof of concept, | |
;; may come with hidden defects that need to be smoothed out by hand during use. | |
;; Attempts to emulate some useful Clojure and Elisp editing functionalities |
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
### Phel wrapping over WP / PHP API's | |
## TODO make a library some day.. | |
(ns my-project\lib\wp | |
(:require phel\str :as str) | |
(:require phel\pdo :as pdo) | |
(:require phel\pdo\statement :as statement)) | |
## Initialize WordPress plugin environment for REPL / tests | |
(defn resolve-wp-load-path |
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
# Some Phel utility fns / macros | |
(ns my-project\utils) | |
(defn parse-float | |
"Converts to float without doing odd type conversions, acting more like | |
Float/parseFloat in Clojure." | |
[x] | |
(when-not (php/is_numeric x) | |
(throw (php/new \InvalidArgumentException | |
(str "Invalid value for parse-float (" x ")")))) |
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
# by Simo / maqq | |
# tl;dr; don't use this but see https://github.com/ikappaki/basilisp-blender | |
import bpy | |
import uuid | |
import traceback | |
from basilisp import main as basilisp, cli | |
from basilisp.lang import compiler, runtime | |
from collections import OrderedDict | |
import socket |
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 | |
/** | |
* Link the FR translation and the EN translation | |
* Called by API https://domain.com/wp-json/link_translation/post/ | |
*/ | |
function custom_rest_link_translation($data) { | |
//Source https://wpml.org/wpml-hook/wpml_set_element_language_details/ |
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 | |
# Connect to a dynamic NGROK endpoint that changes ofter after server restart etc. | |
# Works with single active tunnel (per account) on free tier. | |
# Provides persistent or dedicated endpoint like premium experience. | |
# Requires environment variable $NGROK_APIKEY | |
NGROK_ENDPOINT=$(curl -s https://api.ngrok.com/tunnels -H "authorization: Bearer $NGROK_APIKEY" -H "ngrok-version: 2" | jq -r '.tunnels[0].public_url') | |
NGROK_HOST=$(echo "$NGROK_ENDPOINT" | cut -d':' -f2 | cut -d'/' -f3) |
NewerOlder