Skip to content

Instantly share code, notes, and snippets.

View bartosz-gorny's full-sized avatar

bartosz-gorny

View GitHub Profile
@bartosz-gorny
bartosz-gorny / testRegex.js
Created November 10, 2024 13:08 — forked from hanxiao/testRegex.js
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;
@bartosz-gorny
bartosz-gorny / remove-all-from-docker.sh
Created September 16, 2024 10:17 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@bartosz-gorny
bartosz-gorny / vagrant-multi-node
Created October 11, 2021 10:55
Vagrant template for multi node setup
domain = 'example.com'
nodes = [
{ hostname: 'lb01', ip: '192.168.250.10', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
{ hostname: 'node01', ip: '192.168.250.21', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
{ hostname: 'node02', ip: '192.168.250.22', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
{ hostname: 'node03', ip: '192.168.250.23', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
]
Vagrant.configure('2') do |config|
@bartosz-gorny
bartosz-gorny / forms.py
Created October 4, 2021 14:46 — forked from maraujop/forms.py
django-crispy-forms bootstrap form example
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
@bartosz-gorny
bartosz-gorny / gist_markdown_examples.md
Created November 9, 2020 10:28 — forked from ww9/gist_markdown_examples.md
Gist markdown examples

Gist markdown examples

A collection of Markdown code and tricks that were tested to work in Gist.

This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.

Todo

  • Reformat this whole document and assimilate these:
@bartosz-gorny
bartosz-gorny / gist-markdown-template.md
Created November 9, 2020 10:27 — forked from tgirke/gist-markdown-template.md
Gist Markdown Template

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@bartosz-gorny
bartosz-gorny / 2019-https-localhost.md
Created November 9, 2020 10:25 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).