Skip to content

Instantly share code, notes, and snippets.

@den-crane
den-crane / ch_join_algorithm.sql
Last active April 18, 2024 16:25
CH 22.12 join_algorithm
create table A (A Int64, B Int64, S String) Engine=MergeTree order by A
as select number,number, toString(arrayMap(i->cityHash64(i*number), range(100))) from numbers(1e7);
select * from A a join A as b on a.A = b.A format Null;
SET join_algorithm = 'hash';
Peak memory usage (for query): 32.62 GiB.
0 rows in set. Elapsed: 20.700 sec. Processed 20.00 million rows, 41.31 GB (966.18 thousand rows/s., 2.00 GB/s.)
@Meldiron
Meldiron / backup.sh
Last active April 18, 2024 16:24
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup,
# and make sure you have enough space on the machine.
# After backing up, make sure there is a file in 'backups/backup-___.tar.gz'.
# Also please check size of this file, it should be at least 5kb, even for small instances.
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@DraTeots
DraTeots / ComPort over Network.md
Last active April 18, 2024 16:21
ComPort over Network

Setup colima on ARM Mac to Run x86 Docker Images

Prerequisites

Install Rosetta for x86 instruction support on Mac

$ softwareupdate --install-rosetta
@bradtraversy
bradtraversy / mysql_cheat_sheet.md
Last active April 18, 2024 16:16
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@madjin
madjin / gltf_to_usd.py
Created April 16, 2024 21:05
Blender script to bake each object then export as glTF + USDZ
import bpy
import sys
import os
def unwrap_and_bake_texture(obj, bake_resolution):
# Select the object
bpy.ops.object.select_all(action='DESELECT')
obj.select_set(True)
bpy.context.view_layer.objects.active = obj
@donbr
donbr / README.md
Created April 18, 2024 16:13 — forked from disler/README.md
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains
@egernst
egernst / ipmi-sol.md
Created March 4, 2020 17:51 — forked from krsna1729/ipmi-sol.md
ipmi serial over lan sol

Pre-requisites

Install IPMItools using your package manager on laptop and target machine. Load the drivers on the target.

modprobe ipmi_devintf
modprobe ipmi_si

If you see the following, drivers are not loaded.

@Aschen
Aschen / README.md
Last active April 18, 2024 16:10
Scrape a page and convert it to Markdown

Scrape a page and convert it to Markdown

Install dependencies: npm install playwright cheerio node-html-markdown

Install firefox browser: npx playwright install firefox

Run the script: tsx html-to-md.ts https://mistral.ai/fr/news/mixtral-8x22b/