Skip to content

Instantly share code, notes, and snippets.

View themusicman's full-sized avatar
🏠
Working from home

Thomas Brewer themusicman

🏠
Working from home
View GitHub Profile
defmodule Help do
@moduledoc """
Lets you setup aliases for use in remote console and in dev use too
## Examples
iex> use Help
"""
defmacro __using__(_) do
description allowed_tools
Commit changes without Claude attribution
Bash
Read
Glob
Grep

Commit the current changes to git without Claude attribution. Follow these steps:

  1. Run git status to see what needs to be committed (including untracked files)
  2. Run git diff to review the changes
  3. Add all changes including untracked files:

Below is a snippet you can include in a CLAUDE.md or AGENTS.md file to encourage it to use Conventional Commits when writing commit messages:

YOU MUST use conventional commits when writing commit messages
<type>[scope]: <description>\n\n[body]\n\n[footer(s)]
Type: feat(MINOR), fix(PATCH), or build/chore/ci/docs/style/refactor/perf/test. Req. Scope: Opt, (noun). Desc: Short summary post : . Req. Body: Opt, blank line + paras. Footer: Opt, blank line + token: value/token#value.
Breaking (MAJOR): type[!scope]!: desc or BREAKING CHANGE: desc. Rules: Case-insensitive, except BREAKING CHANGE. feat=feature, fix=bug.
ex:
feat: config extend\n\nBREAKING CHANGE: extends key configs
feat!: email ship
# https://www.atlassian.com/git/tutorials/dotfiles
git clone --bare [email protected]:themusicman/conf.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
@themusicman
themusicman / help.ex
Created June 10, 2024 13:38
Elixir Help Module
defmodule Help do
@moduledoc false
defmacro __using__(_opts) do
quote do
import Ecto.Changeset
import Ecto.Query
# other import, alais, and code ...
:ok
[debug] Elixir.ER.Destinations.Manager.Server.start_destination_pipeline(%ER.Destinations.Destination{__meta__: #Ecto.Schema.Metadata<:loaded, "destinations">, id: "a23e555e-460d-4e32-9eb6-13da92897a22", name: "s3_users", offset: nil, ordered: false, destination_type: :s3, paused: false, config: %{"s3_bucket" => "eventrelay-dev", "s3_region" => "us-east-2"}, config_json: nil, topic_identifier: nil, group_key: nil, signing_secret: "X1KFbu42hJ2GOf6jcbKrRHIBGWjJ0djHMiffeD4X3fr5cWsxYP_bH7cF6wr464vs", query: nil, topic_name: "users", topic: #Ecto.Association.NotLoaded<association :topic is not loaded>, inserted_at: ~U[2024-01-02 21:14:01Z], updated_at: ~U[2024-01-02 21:14:01Z]} starting pipeline. pipeline=ER.Destinations.Pipeline.S3
[debug] Elixir.ER.Destinations.Pipeline.S3.child_spec with child_spec=%{id: "Elixir.ER.Destinations.Pipeline.S3:base:destination:pipeline:s3:a23e555e-460d-4e32-9eb6-13da92897a22", shutdown: :infinity, start: {ER.Destinations.Pipeline.S3, :start_link, [[destination: %ER.Destinations.Des
@themusicman
themusicman / gist:58908ebdf708c4dc8118cee23ff71fde
Created February 2, 2022 13:38
TokBox streamDestroyed event
{
"type": "streamDestroyed",
"cancelable": true,
"_defaultPrevented": false,
"stream": {
"id": "7e24f084-d971-46d6-936d-ced2ba4e2817",
"streamId": "7e24f084-d971-46d6-936d-ced2ba4e2817",
"name": "",
"creationTime": 1643809018166,
"connection": {
@themusicman
themusicman / recipe-updating-maps
Created June 5, 2019 13:35
Updating Maps in Elixir
# A map in Elixir is a key => value data structure
thomas = %{first_name: "Thomas", age: 38, job_title: "Director of Awesome"}
# There are multiple ways to update a Map in Elixir like
# put/3 - https://hexdocs.pm/elixir/Map.html#put/3
thomas = Map.put(thomas, :age, 39)
%{first_name: "Thomas", age: 39, job_title: "Director of Awesome"}
# merge/2 - https://hexdocs.pm/elixir/Map.html#merge/2
<a href="http://spammer-site.com" rel="nofollow">Look at me</a>
@themusicman
themusicman / elasticsearch-model-example.rb
Last active February 9, 2016 19:44
Increasing the size of the search records returned
Legislator.search(params[:q], size: 10000).records.where(chamber: params[:chamber]).order('voting_sessions.score asc, last_name asc')