Skip to content

Instantly share code, notes, and snippets.

View omril321's full-sized avatar
🧑‍💻
Creating something cool

Omri Lavi omril321

🧑‍💻
Creating something cool
View GitHub Profile
@omril321
omril321 / create-hook.md
Created September 24, 2025 17:46
A Claude Code command used to create high quality hooks for your project. Extremely useful for quickly creating hooks that lint, format and type-check your code while Claude Code edits them - ensuring flawless DX.

Create Hook Command

Create and manage Claude Code hooks with intelligent suggestions based on your project setup.

📖 Official Documentation Reference

Always consult the latest official docs for API updates:

⚠️ Note: If there are discrepancies between this command and the official docs, the official documentation takes precedence.

@omril321
omril321 / deep_inspect_docker_stats.sh
Created August 15, 2021 18:44
Prints out the docker stats along with all the CPU and memory usage of all the containers from a specific image
IMAGE_NAME="image_name";
docker stats --no-stream; docker ps | grep $IMAGE_NAME | cut -d " " -f1 | for i in $(cat) ; do echo "ps for cotainer id: ${i} "; docker exec $i cat /proc/meminfo; docker exec $i cat /proc/cpuinfo; ; done
@omril321
omril321 / watch-pr.sh
Created August 15, 2021 18:40
Send a Slack message when the GitHub PR checks status changes to Failed or Success
# Polls the status of a GitHub's PR, using the CLI (gh).
# When the status changes from "Pending" to "Failed" or "Success", sends a Slack message with the details.
#
# Usage:
# $ SLACK_WEBHOOK="<YOUR_SLACK_WEBHOOK>" watch-pr.sh [optional_gh_options] &> /dev/null &
# For convenience, define a utility function:
#
# $ wpr () { SLACK_WEBHOOK="<YOUR_SLACK_WEBHOOK>" watch-pr.sh "$@" &> /dev/null & }
# And then use with:
# $ wpr # (watches the PR of the current branch)
@omril321
omril321 / countFilesContainingPhraseInCommit.js
Created January 25, 2021 06:42
Grep a phrase in specific files (using globs) in a specific git tree, and the count the number of matches
function countFilesContainingPhraseInCommit({commitHash, filesGlobs, phrase, repositoryPath}) {
return new Promise(resolve => {
const gitGrep = child_process.spawn('git', ['grep', '-r', '--files-with-matches', `${phrase}`, `${commitHash}`, ...filesGlobs], { cwd: repositoryPath });
let output = '';
gitGrep.stdout.on('data', (buff: Buffer) => {
output = output.concat(buff.toString());
});
gitGrep.on('exit', () => {
//each line is a file that matches
@omril321
omril321 / stylelint-rule_5.json
Created September 16, 2020 05:52
stylelint-rule_5.json
//.stylelintrc.json
{
"plugins": [
"./no-blue-color.js"
],
"rules": {
"testim-plugin/no-blue-color": true
}
}
@omril321
omril321 / stylelint-rule_4.js
Created September 16, 2020 05:51
stylelint-rule_4.js
//no-blue-color.js
const stylelint = require('stylelint');
const { report, ruleMessages, validateOptions } = stylelint.utils;
const ruleName = 'testim-plugin/no-blue-color';
const messages = ruleMessages(ruleName, {
expected: (unfixed, fixed) => `Expected "${unfixed}" to be "${fixed}"`,
});
@omril321
omril321 / stylelint-rule_3.js
Last active September 16, 2020 05:48
stylelint-rule_3.js
module.exports = stylelint.createPlugin(ruleName, function getPlugin(primaryOption, secondaryOptionObject, context) {
return function lint(postcssRoot, postcssResult) {
const validOptions = validateOptions(
postcssResult,
ruleName,
{
//Options schema goes here
}
);
@omril321
omril321 / stylelint-rule_2.js
Created September 16, 2020 05:31
stylelint-rule_2.js
module.exports.ruleName = ruleName;
module.exports.messages = messages;
module.exports = stylelint.createPlugin(ruleName, function ruleFunction(primaryOption, secondaryOptionObject, context) {
return function lint(postcssRoot, postcssResult) {
// ...
}});
@omril321
omril321 / stylelint-rule_1.js
Created September 16, 2020 05:30
stylelint-rule_1
// no-color-blue.js
const stylelint = require('stylelint');
const { ruleMessages, validateOptions } = stylelint.utils;
const ruleName = 'testim-plugin/no-color-blue';
const messages = ruleMessages(ruleName, {
//… linting messages can be specified here
});