Skip to content

Instantly share code, notes, and snippets.

@hanxiao
hanxiao / testRegex.js
Last active April 14, 2025 03:31
Regex for chunking by using all semantic cues
// Updated: Aug. 20, 2024
// Run: node testRegex.js whatever.txt
// Live demo: https://jina.ai/tokenizer
// LICENSE: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// COPYRIGHT: Jina AI
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
@eytanhanig
eytanhanig / home_row_modifiers-to_alone.json.rb
Last active November 13, 2023 22:52
Karabiner Home Row Modifiers
#!/usr/bin/env ruby
require 'json'
def main
puts JSON.pretty_generate(
"title" => "@ Home Home Row Keys for Modifiers (using if_alone)",
"maintainers" => ["eytanhanig"],
# # Uncomment conditions to only apply modifications to internal apple keboards
# "conditions" => [
@toranb
toranb / bert_medium_training.ex
Last active November 14, 2023 15:56
The bumblebee fine tuning example with one of the smaller Pytorch pre-trained BERT variants
defmodule Training.Example do
def train() do
Nx.default_backend(EXLA.Backend)
{:ok, spec} =
Bumblebee.load_spec({:hf, "prajjwal1/bert-medium"},
module: Bumblebee.Text.Bert,
architecture: :for_sequence_classification
)
@mtotowamkwe
mtotowamkwe / alpine_linux_with_sqlite_docker_image.md
Created December 27, 2020 04:43
How to build an Alpine Linux docker image with an instance of SQLite installed using a Dockerfile.

Building docker images with Dockerfiles.

To build an alpine linux docker image with sqlite.

  • Create a directory.
  • In the directory above create a Dockerfile.
  • Add the desired commands in the Dockerfile.

Following are the commands in the Dockerfile.

// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@bultas
bultas / colors.css
Last active November 16, 2020 11:48
CSS Colors
:root {
--black: #000;
--white: #fff;
--rose-50: #fff1f2;
--rose-100: #ffe4e6;
--rose-200: #fecdd3;
--rose-300: #fda4af;
--rose-400: #fb7185;
--rose-500: #f43f5e;
@WebReflection
WebReflection / why-i-use-web-components.md
Last active October 18, 2024 10:55
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@brockthebear
brockthebear / convert.sh
Last active November 15, 2024 16:22
Recursively find and convert files in place using ImageMagick and Mogrify
# This command would be run from the parent folder that:
# 1. contains the file(s) to be converted
# 2. has subdirectories that contain files to be converted
# 3. both of the above.
# This example finds all .tif files and converts them to .pdf,
# but any conversion supported by ImageMagick could be used here.
# If you don't have ImageMagick installed, you can do so here (https://imagemagick.org/script/download.php)
# for linux
@drejohnson
drejohnson / Index.re
Last active June 30, 2020 21:03
basic reasonml binding for lit-html. WIP
/* Works but props not added to values array */
let sayHello = name =>
LitHtml.html(
{j|
<h1>Hello $(name) </h1>
<p>Goodbye</p>
<div>
<span>This is nested</span>
</div>
|j},