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 / mastodon-reach-analytics.py
Created October 8, 2023 16:16
How far did my post go on the Fediverse?
# Original Src: https://shkspr.mobi/blog/2023/09/how-far-did-my-post-go-on-the-fediverse/
import config
from mastodon import Mastodon
from rich.pretty import pprint
# Set up access
mastodon = Mastodon( api_base_url=config.instance, access_token=config.access_token, ratelimit_method='pace' )
# Status to check for
@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 / webapps-in-native-wrapper-options.md
Last active November 24, 2022 08:06
Wrap web applications into native apps that are cross OS compatible and out perform Electron
@bhattisatish
bhattisatish / AWS-User-Data
Last active October 29, 2022 10:11
Cloud-Init file / User data file
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
@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 / index2html.sed
Last active December 21, 2023 10:05
Useful One-liners for sed
#!/usr/bin/sed -f
# index2html.sed - by Aurelio Jargas
# Get index.sed file and converts it to the main http://sed.sf.net page
#
1 i\
<html><head><title>sed.sf.net - The sed $HOME</title></head>\
<meta http-equiv="content-type" content="text/html; charset=utf-8">\
<body bgcolor="#ffffbb" text="black">\
<pre>