Skip to content

Instantly share code, notes, and snippets.

@igorburago
igorburago / partsort.c
Last active May 23, 2024 12:04
Fast partial sorting of an array subinterval
#include <math.h> /* for partition_floyd_rivest() */
#include <stddef.h> /* ptrdiff_t */
#include <stdint.h>
#include <string.h> /* memcpy() */
/* Built-in u128 is not strictly required, but it makes mcg64 simpler and faster. */
typedef __uint128_t uint128_t;
#define mustinline inline __attribute__((always_inline))

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

@KalebNyquist
KalebNyquist / lookupZoteroCollections.js
Created August 8, 2021 21:44
One of my frustrations with Zotero is that there is no easy way to list all the collections in which a file is stored. This is my band-aid of a solution. The code can be run under Tools > Developer > Run Javascript using "Sync" mode.
// Instructions:
// (1) Highlight file of interest.
// (2) Run code in Zotero's JavaScript console (found under Tools > Developer > Run Javascript) in sync mode.
function collections_output() {
zp = Zotero.getActiveZoteroPane()
items = zp.getSelectedItems()
collection_ids = items[0]["_collections"]
collections_cache = Zotero.Collections._objectCache
@Lh4cKg
Lh4cKg / install_hp.sh
Last active May 23, 2024 11:58
Installing networked HP printer and scanner on Fedora Linux
# docs for more information see the official HPLIP project site here.
# https://developers.hp.com/hp-linux-imaging-and-printing
# Step 1. Update Fedora Linux
# Simply run dnf command:
$ sudo dnf upgrade
# Step 2. Search for HPLIP software
@mpryc
mpryc / .Cluster Scripts.md
Created May 23, 2024 11:57 — forked from weshayutin/.Cluster Scripts.md
Cluster Creation Scripts

Cluster Creation Scripts

Scripts to use as inspiration for your own OpenShift clusters.

Setup

  1. Create a directory with the name of the cluster you want to create.
  2. Generate an install-config.yaml (for example, using openshift-install create install-configs).
  3. Copy your install-config.yaml to install-config.yaml.save. This ensures you still have a copy after the installer deletes install-config.yaml. Add a bin/ subdirectory and add it to the begining of your PATH. I recommend you use [direnv][1] to manage this (sudo dnf install direnv).
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 23, 2024 11:57
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@hurricane-voronin
hurricane-voronin / README.md
Last active May 23, 2024 11:54
Naming Classes Without a 'Manager'

Ruby: The future of frozen string literals

What is a literal?

In programming languages, literals are textual representations of values in the source code. This is a syntactical concept.

Some examples:

7 # integer literal
@jaylattice
jaylattice / mine-monero.md
Last active May 23, 2024 11:49
HOW TO MINE MONERO SOLO OR IN A POOL - GOOD FOR CPUs, EASY TO SET UP.

Preface

After reading this guide, you should be able to mine Monero as a solo node using your own computer, either with the default daemon or with dedicated mining software like XMRig. You will learn how to participate in a free, decentralized mining pool which pays out XMR cryptocurrency to your wallet continouously. Monero is widely considered the most elegant cryptocurrency. The IRS is offering a bounty between $625k and $1.25m to anyone who can crack its privacy-conserving algorithm. Monero is effectively a digitial implementation of cash. If Alice gives Bob cash in her own home, nobody in the world knows about it. Monero — for now — conserves this property. Bitcoin, contrary to popular belief, is not digital cash. If Alice sends Bob some Bitcoin, the entire world knows about it — a wet dream for the IRS.

*These instructions are for Windo

@jfryman
jfryman / 0_Voron-CAN.md
Last active May 23, 2024 11:46
Setting up EBB36 + U2C on Klipper for Voron

Here's what's worked for me. As always, YMMV.

Writing this down for my own history just as much as it might help someone else. I've done two nine machines so far this way. Hope this helps someone!

  • Hardware used: EBB36 v1.1 + U2C v1.2
  • CAN wiring: Get FEP Wire. Used to recommend 18 Gauge for Power, reclaimed twisted pair from CAT-5 or CAT-6 cable for CAN-H, CAN-L, but I've also received failures eventually from my CAT-6 cable. It's not rated for the movement. Get better cables.

Ensure wiring is setup properly.

Easy way to remember: Ensure power is correctly wired on each end (it's different) and then pair CAN-L with GROUND below, and CAN-H with 24V below in each of the connectors. Image references below.