Skip to content

Instantly share code, notes, and snippets.

Home/Core TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home/Core (Country Specific) PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
Home/Core (Single Language) 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
Home/Core N 3KHY7-WNT83-DGQKR-F7HPR-844BM
Professional W269N-WFGWX-YVC9B-4J6C9-T83GX
Professional N MH37W-N47XK-V7XM9-C7227-GCQG9
Professional Enterprise
Professional Workstation
Enterprise NPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise N DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
@c7x43t
c7x43t / magento.sh
Created December 15, 2023 13:02
Notes on magento and how to execute commands without memory limit and with debug information.
Essentially:
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento {command} -vvv
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento deploy:mode:set production -vvv
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento indexer:reindex -vvv
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento deploy:mode:set default -vvv
php bin/magento maintenance:status
php bin/magento maintenance:disable
日立製作所は4日、家電量販店などが勝手に値引きできない家電の「指定価格制度」を始めた。長年、量販店に握られてきた価格の決定権をメーカーの手に戻そうとする動きで、国内家電大手ではパナソニックに次ぐ2社目。今後、業界でどこまで広がるかが注目される。 子会社の日立グローバルライフソリューションズ(GLS)が4日、11月に発売する最新のドラム式洗濯乾燥機「ビッグドラム」2機種を発表した。価格は洗濯容量13キロの製品が37万円前後(税込み)、12キロが33万円前後(同)の予定。価格は日立による指定で、制度に参加する量販店や通販サイトなど、「正規取扱店」約1万5千店舗で販売する。 メーカーによる価格の拘束は独占禁止法で禁じられている。ただ、今回の制度は店からの返品を受け付け、売れ残りのリスクを日立が負う形にすることで、法的な問題をクリアしたという。今後、11月以降に発売する洗濯機や冷蔵庫などの白物家電の1割程度、主に付加価値の高い製品を対象にする見込みだ。
@c7x43t
c7x43t / BigIntToUInt16ArraySerialization.js
Last active April 13, 2023 10:53
Serialize a javascript BigInt space efficient and fast to an UInt8Array and back.
const big_zero = BigInt(0);
const big_16 = BigInt(16);
const big_2p16m1 = BigInt(2**16-1); // 0xFFFFn
function bigIntToUint16Array(bigInt) {
const bitLength = Math.ceil(Math.log2(Number(bigInt) + 1));
const arrayLength = (bitLength + 15) >>> 4;
const uint16Array = new Uint16Array(arrayLength);
let tempValue = bigInt;
for (let i = 0; i < arrayLength; i++) {
const mailRegex = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi
function getValidMails(str){
return Array.from(str.matchAll(mailRegex))
}
function containsValidEmail(str){
return getValidMails(str).length>0
}
function isValidEmail(str){
let mail = str.match(mailRegex);
return mail && mail[0].length === str.length;
Quantum Safe Algorithms:
https://openquantumsafe.org/liboqs/algorithms/
Quantum Safe openssl implementation (Open Quantum Safe):
https://github.com/open-quantum-safe/openssl
Note: Combination of classical and quantum algorithms via <classical_tag>_<quantum_tag> possible.
Open Quantum Safe examples for popular applications:
https://github.com/open-quantum-safe/oqs-demos
Signature schemes:
{{template config_path="design/email/header_template"}}
<table>
<tr class="email-intro">
<td>
<p class="greeting">{{trans "%customer_name," customer_name=$order_data.customer_name}}</p>
<p>
{{trans "Thank you for your order from %store_name." store_name=$store.frontend_name}}
{{trans "Once your package ships we will send you a tracking number."}}
{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
function getUrlQueryParams(url){
return Object.fromEntries((new URLSearchParams(new URL(url).search)));
}
// Primitives, Date, RegExp, Functions, all Arrays, Object, Object with null Prototype, all Errors, circular Objects, Map, Set, Fuction Arguments
// ToDo: self referencing structures are not correcly handled (in certain cases non-self referencing structures are falsely labeled), but they never fail to stringify
// Notes: https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript/53263848#53263848
var objectHash = (function(){
var primitiveTypes = new Set();
primitiveTypes.add('Date');
primitiveTypes.add('RegExp');
primitiveTypes.add('Number');
primitiveTypes.add('String');
primitiveTypes.add('Boolean');
function csvToJson(csv){
var delimiterRow = /\n/;
var delimiterCol = ',';
var rows=csv.split(delimiterRow).map(e=>e.trim()).filter(e=>e!=='');
var res=[];
var names=[];
for(var name of rows[0].split(delimiterCol).map(e=>e.trim())) names.push(name);
for(var i=1;i<rows.length;i++){
var obj={}
var values = rows[i].split(delimiterCol).map(e=>e.trim())