Skip to content

Instantly share code, notes, and snippets.

View codekiln's full-sized avatar
🎧
Feedback Loops

M∎r codekiln

🎧
Feedback Loops
View GitHub Profile
@codekiln
codekiln / #_Git_Alias_to_Supply_Dir_Context_to_AI.md
Last active January 19, 2025 11:02
Supplying directory context to AI that respects a .gitignore

Git Alias to Supply Directory Context to AI

When collaborating with AI tools for code assistance, it's beneficial to provide them with an overview of your project's directory structure, excluding files specified in .gitignore. This ensures that the AI has relevant context without being cluttered by unnecessary or ignored files. This gist sets up the ability to use git lsf to list all relevant files and git lsfwd to list files specific to the current working directory in a way that respects .gitignore exclusions.


Setting Up the Git Aliases

Alias: lsf

You can create a Git alias named lsf to list all tracked and untracked files, excluding those ignored by Git. To set up this alias, execute the following command:

@codekiln
codekiln / # Generate Markdown Commit Link Script.md
Last active December 19, 2024 17:10
Generate Markdown Commit Link Script
@codekiln
codekiln / keyrepeat.shell
Created December 4, 2018 17:46 — forked from rastasheep/keyrepeat.shell
Enable key repeat in Apple Lion for Atom in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Atom if you're running vim mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@codekiln
codekiln / classnames_test.py
Created June 4, 2018 14:30
Testing self.__variables, class.__variables and inheritance in Python
class ParentClass(object):
__special = ''
def __init__(self, *args, **kwargs):
self.__class__.__special = 'ParentClass'
self.__special = 'ParentClass'
print self.__dict__
def special(self):
@codekiln
codekiln / beautiful_soup_utils.py
Last active March 16, 2018 08:44
get_text_from_html using beautifulsoup; skip comments in style tags from MS Word
from bs4 import BeautifulSoup
def get_text_from_html(html_str):
"""
Given a string of html, return the text content,
removing HTML contents and style artifacts.
This function solves an issue that when pasting from Word,
<style> tags can contain html comments that bsoup 4
doesn't skip over when calling get_text().
@codekiln
codekiln / list_all_model_signals.py
Last active November 17, 2017 20:12 — forked from runekaagaard/list_all_model_signals.py
List all signals by model and signal type. Tested with Django 1.9 and MongoEngine
# coding:utf-8
import ctypes
import gc
import inspect
from collections import defaultdict
import re
from blinker import NamedSignal
from django.core.management.base import BaseCommand
@codekiln
codekiln / find_sorted_django_management_commands.sh
Created November 15, 2017 16:32
list all sorted django management commands using git
#!/usr/bin/env bash
# after running this command, the list of management commands will be in
# `sorted_management_commands.txt`, which you can `cat` out.
rm -f management_commands.txt
touch management_commands.txt
for i in **/management/commands/*.py
do echo "$(git log -1 --format='%ad | %C(green)%ae%Creset |' --date=short -- $i) $i" >> management_commands.txt
done
cat management_commands.txt | sort >! sorted_management_commands.txt
@codekiln
codekiln / immutablejs-react-table-with-multiple-sort-and-styled-components.markdown
Created October 22, 2017 11:16
ImmutableJS React Table With Multiple Sort And Styled Components

ImmutableJS React Table With Multiple Sort And Styled Components

An example of how to make a multi-sort React table with ImmutableJS and Styled Components, using ImmutableJS Records.

A Pen by Myer Nore on CodePen.

License.

@codekiln
codekiln / slack_postback_lambda.js
Created September 13, 2017 23:56
AWS Lambda Post To Slack Channel from DynamoDB
var AWS = require('aws-sdk');
var path = require('path');
var https = require('https');
/**
* This assumes that messages are added to DynamoDB
* with parameters `name` and `message`.
*
* To get this to work with your slack channel, you
* first need to configure Incoming Webhook for your
@codekiln
codekiln / tarhash.py
Last active March 14, 2024 23:40
Get the checksum of a tarfile by path
def tarhash(tarpath, hash='sha1'):
"""
given a path to a tar file, return a checksum of its
summed / concatenated contents.
tarpath - a tar.gz path string to open
hash - one of the hash methods supported by hashlib
"""
total_hash = hashlib.new(hash)
with open(tarpath, 'rb') as input_file: