Skip to content

Instantly share code, notes, and snippets.

@bhattisatish
bhattisatish / .bash_hooks
Created October 20, 2023 07:34 — forked from KeyAmam/.bash_hooks
A script which defines actions before and after each command execution
#!/bin/bash
# NOTES
# To activate hooks, run:
# . ./.bash_hooks
# To clear hooks, run:
# trap '' DEBUG
# PROMPT_COMMAND=
@bhattisatish
bhattisatish / post-checkout
Created October 20, 2023 07:22 — forked from KeyAmam/post-checkout
post-checkout hook to configure a git account to a repo only after git clone (not after git checkout)
#!/bin/bash
# NOTES
# set git accounts info in ~/.sources/.gitvariables like so:
# GIT_USER_NAME_WORK=...
# GIT_USER_EMAIL_WORK=...
# GIT_SSH_NAME_WORK=...
# GIT_USER_NAME_PRIVATE=...
# GIT_USER_EMAIL_PRIVATE=...
# GIT_SSH_NAME_PRIVATE=...
@bhattisatish
bhattisatish / slack_history.py
Created August 17, 2023 19:06 — forked from Chandler/slack_history.py
Download Slack Channel/PrivateChannel/DirectMessage History
# MIT License
# Copyright (c) 2016 Chandler Abraham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@bhattisatish
bhattisatish / jq-cheetsheet.md
Last active November 8, 2023 04:17 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Ubuntu

sudo apt-get install jq

On Mac OS

@bhattisatish
bhattisatish / tree_sitter_guide.md
Created July 14, 2021 02:51 — forked from Aerijo/tree_sitter_guide.md
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

@bhattisatish
bhattisatish / song.rb
Created September 9, 2012 11:48 — forked from natew/song.rb
Rails model for parsing artist information from a song
class Song
# Regular expressions
RE = {
:featured => /(featuring | ?ft\.? |feat\.? |f\. |w\/){1}/i,
:remixer => / remix| rmx| edit| bootleg| mix| remake| re-work| rework| extended remix| bootleg remix/i,
:mashup_split => / \+ | x | vs\.? /i,
:producer => /^(produced by|prod\.? by |prod\. )/i,
:cover => / cover/i,
:split => /([^,&]+)(& ?([^,&]+)|, ?([^,&]+))*/i, # Splits "one, two & three"
:open => /[\(\[\{]/,
@bhattisatish
bhattisatish / heroku_deploy.rake
Created April 7, 2012 12:59 — forked from michaeldwan/heroku_deploy.rake
Simple Rake task for customizing deployment to Heroku
# List of environments and their heroku git remotes
ENVIRONMENTS = {
:staging => 'myapp-staging',
:production => 'myapp-production'
}
namespace :deploy do
ENVIRONMENTS.keys.each do |env|
desc "Deploy to #{env}"
task env do
@bhattisatish
bhattisatish / deploy.rake
Created April 7, 2012 06:58 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@bhattisatish
bhattisatish / hack.sh
Created March 31, 2012 12:18 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#