Skip to content

Instantly share code, notes, and snippets.

View jmdfm's full-sized avatar
💭
😺

John McDowall jmdfm

💭
😺
View GitHub Profile
13:03 [jmd@eris] cal.com ⟩ (U main) NEXT_TURBOPACK_TRACING=1 yarn dx
turbo 2.4.4
• Packages in scope: @calcom/alby, @calcom/amie, @calcom/api, @calcom/api-proxy, @calcom/api-v2, @calcom/app-store, @calcom/app-store-cli, @calcom/applecalendar, @calcom/around, @calcom/atoms, @calcom/attio, @calcom/autocheckin, @calcom/baa-for-hipaa, @calcom/base, @calcom/basecamp3, @calcom/bolna, @calcom/caldavcalendar, @calcom/campfire, @calcom/chatbase, @calcom/clic, @calcom/closecom, @calcom/config, @calcom/cron, @calcom/dailyvideo, @calcom/dayjs, @calcom/debugging, @calcom/deel, @calcom/demodesk, @calcom/dialpad, @calcom/discord, @calcom/ee, @calcom/eightxeight, @calcom/element-call, @calcom/elevenlabs, @calcom/emails, @calcom/embed-core, @calcom/embed-react, @calcom/embed-snippet, @calcom/eslint-plugin-eslint, @calcom/example-app-credential-sync, @calcom/exchange2013calendar, @calcom/exchange2016calendar, @calcom/exchangecalendar, @calcom/facetime, @calcom/fathom, @calcom/feature-auth, @calcom/features, @calcom/feishucal
@jmdfm
jmdfm / kamal-production-server-setup.sh
Created December 15, 2024 01:53 — forked from rameerez/kamal-production-server-setup.sh
Set up a Ubuntu server to deploy Kamal 2.x Docker containers to, hardened security and production ready
#!/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 ---
@jmdfm
jmdfm / tailwindForms.js
Created October 10, 2024 03:32 — forked from srcrip/tailwindForms.js
This is just a copy-and-paste of the Tailwind Forms plugin that you can actually edit/customize/maintain + JSDoc types.
// 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
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(' ')
@jmdfm
jmdfm / keymap.json
Created June 6, 2024 23:53 — forked from adibhanna/keymap.json
zed keymaps
[
{
"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",
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
@jmdfm
jmdfm / lsp.lua
Created February 19, 2024 23:42
Setup TailwindCSS LSP in LazyVim to provide completions in Ruby / Phlex components
-- 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)
@jmdfm
jmdfm / cheatsheet.rb
Created February 18, 2024 18:02 — forked from mabenson00/cheatsheet.rb
Rails ActiveRecord JSON cheatsheet
# 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
# Required minimum dip version
version: "7.1.1"
environment:
COMPOSE_EXT: development
compose:
files:
- .docker/docker-compose.yml
project_name: vocsurveys
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|