This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Production Docker Host Hardening Script v2 | |
# For Ubuntu Server 24.04 LTS (Noble) | |
# Suitable for both Kamal deployment and builder hosts | |
set -euo pipefail | |
IFS=$'\n\t' | |
# --- Constants --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tailwind plugin for forms. | |
// Basically: https://github.com/tailwindlabs/tailwindcss-forms/blob/main/src/index.js | |
// But with a few changes. And it's easier to maintain this way. | |
const svgToDataUri = require("mini-svg-data-uri") | |
const plugin = require("tailwindcss/plugin") | |
const defaultTheme = require("tailwindcss/defaultTheme") | |
const colors = require("tailwindcss/colors") | |
const [baseFontSize, { lineHeight: baseLineHeight }] = | |
defaultTheme.fontSize.base | |
const { spacing, borderWidth, borderRadius } = defaultTheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoTokenizer, AutoModel | |
import torch | |
# MODEL CKPT is downloaded from: "jinaai/jina-embeddings-v2-base-en" # has context len of 8192 | |
MODEL_CKPT = "/Users/rohan/3_Resources/ai_models/jina-embeddings-v2-base-en" | |
def recursive_splitter(text: str, separators: list[str], chunk_size: int) -> list[str]: | |
if len(separators) == 0: | |
words = text.strip().split(' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"context": "Editor && VimControl && !VimWaiting && !menu", | |
"bindings": { | |
"ctrl-w z": "workspace::ToggleZoom", | |
"ctrl-w t": "terminal_panel::ToggleFocus", | |
"g ]": "editor::GoToDiagnostic", | |
"g [": "editor::GoToPrevDiagnostic", | |
"g r": "editor::FindAllReferences", | |
"shift-k": "editor::Hover", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker | [IMPORTANT] | |
worker | Don't forget to include the Crash Report log file under | |
worker | DiagnosticReports directory in bug reports. | |
worker | | |
worker | /Users/jmd/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/pg-1.5.6/lib/pg/connection.rb:695: [BUG] Segmentation fault at 0x000000011d800b04 | |
worker | ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23] | |
worker | | |
worker | -- Crash Report log information -------------------------------------------- | |
worker | See Crash Report log file in one of the following locations: | |
worker | * ~/Library/Logs/DiagnosticReports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- textDocument/diagnostic support until 0.10.0 is released | |
_timers = {} | |
local function setup_diagnostics(client, buffer) | |
if require("vim.lsp.diagnostic")._enable then | |
return | |
end | |
local diagnostic_handler = function() | |
local params = vim.lsp.util.make_text_document_params(buffer) | |
client.request("textDocument/diagnostic", { textDocument = params }, function(err, result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Required minimum dip version | |
version: "7.1.1" | |
environment: | |
COMPOSE_EXT: development | |
compose: | |
files: | |
- .docker/docker-compose.yml | |
project_name: vocsurveys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "json" | |
Rack::Attack.safelist("allow RSpec") { |_req| Rails.env.test? } | |
Rack::Attack.safelist("allow development") { |req| Rails.env.development? } | |
# Allow the other containers on the server unlimited access, tweak IP range for your situation | |
Rack::Attack.safelist_ip("10.10.0.0/24") | |
# Limit data modification requests | |
Rack::Attack.throttle("unsafe/req/ip", limit: 30, period: 60.seconds) do |req| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_ecr_repository" "repo" { | |
name = "${var.product_name}-app" | |
} | |
resource "aws_ecr_lifecycle_policy" "ecr-lifecycle-policy" { | |
repository = aws_ecr_repository.repo.name | |
policy = jsonencode({ | |
rules = [ | |
{ |
NewerOlder