Skip to content

Instantly share code, notes, and snippets.

View ahmadawais's full-sized avatar
Building the LLM computing primitive at Langbase.com

Ahmad Awais ⌘ ahmadawais

Building the LLM computing primitive at Langbase.com
View GitHub Profile
@ahmadawais
ahmadawais / .profile
Created August 27, 2020 08:11 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@ahmadawais
ahmadawais / index.js
Created August 23, 2020 12:54
remark-widow
const visit = require('unist-util-visit')
module.exports = () => (tree, file) => {
visit(tree, 'heading', node => {
console.log('node: ', node);
visit(node, 'text', textNode => {
console.log('textNode: ', textNode);
const text = textNode.value ? textNode.value.trim() : ''
// const textNoWidows = text.replace(/\s+([\S]*)(\s*)$/gm, "\xA0$1$2");
@ahmadawais
ahmadawais / .zshrc
Created July 26, 2020 05:31
🦄 Shades of Purple theme for fzf
# fzf theme.
# Base16 Atelier Plateau Light
_gen_fzf_default_opts() {
local color00='#2D2B55'
local color01='#1E1E3F'
local color02='#A599E9'
local color03='#A599E9'
local color04='#A599E9'
local color05='#A599E9'
@ahmadawais
ahmadawais / .zshrc
Created July 3, 2020 15:01
manpdf opens man pages as PDF
# Open man page as PDF.
# USAGE: manpdf cat
function manpdf() {
man -t "${1}" | open -f -a /Applications/Preview.app/
}
@ahmadawais
ahmadawais / javascript.json
Last active June 29, 2020 17:58
VSCode Console Log Snippets
{
"Console Log with Name": {
"prefix": "lg",
"body": ["console.log(`${1:variable}`, ${1:variable});"],
"description": "Console Log with name of a variable"
},
"Console Log with String": {
"prefix": "lgs",
"body": ["console.log(`${1:STRING_HERE}`);"],
"description": "Console Log string"
@ahmadawais
ahmadawais / getTwitterImage.js
Created June 21, 2020 10:26
Scrape a twitter image with JavaScript.
const cheerio = require('cheerio')
const got = require('got')
// https://dev.twitter.com/basics/user-profile-images-and-banners
const REGEX_IMG_MODIFIERS = /_(?:bigger|mini|normal)\./
const ORIGINAL_IMG_SIZE = '_400x400'
const getAvatarUrl = url =>
url.replace(REGEX_IMG_MODIFIERS, `${ORIGINAL_IMG_SIZE}.`)
@ahmadawais
ahmadawais / .zshrc
Created November 26, 2019 23:43
#OneDevMinute: Git archive the current directory and ignore everything in .gitignore file.
# Git archive the current directory
# and ignore everything in .gitignore file.
# Usage: garc zipname
alias garc="git archive -o $1.zip HEAD"
@ahmadawais
ahmadawais / .zshrc
Last active October 22, 2019 22:17
🔥 #OneDevMinute: Type `git open` to open the GitHub page or website for a repository.
# Type `git open` to open the GitHub page or website for a repository.
# Step #1: npm install -g git-open
# Step #2: cd local_repo_directory
# Strep #3 git open
# More examples: https://github.com/paulirish/git-open
# Bonus use the following aliases
# @usage gio
alias gio="git open"
@ahmadawais
ahmadawais / .zshrc
Created October 21, 2019 19:58
Check the whois of a domain from the command line.
# Check the whois of a domain or form a URL.
# @usage: whois google.com
# @usage: whois https://google.com
function whois() {
local domain=$(echo "$1" | awk -F/ '{print $3}') # get domain from URL
if [ -z $domain ] ; then
domain=$1
fi
echo "Getting whois record for: $domain …"
@ahmadawais
ahmadawais / .zshrc
Last active October 17, 2019 17:21
🔥 #OneDevMinute: Reload your bash or Zsh shell.
# Reload the shell (i.e. invoke as a login shell).
alias reload="exec $SHELL -l"
alias rf="source ~/.zshrc"
# Typos addressed.
alias relaod="reload"
alias reld="reload"
alias rld="reload"