Skip to content

Instantly share code, notes, and snippets.

Automating everything with

Ahmad Awais ⚡️ ahmadawais

Automating everything with
View GitHub Profile
ahmadawais / tailwind.config.js
Created Jan 4, 2021
Tailwind Text Decoration Color Utilities Plugin
View tailwind.config.js
const decoration = plugin(function ({ e, addUtilities, theme }) {
colors = theme('colors');
const decorationColors = Object.keys(colors).reduce((acc, key) => {
if (typeof colors[key] === 'string') {
return {
[`.decoration-${e(key)}`]: {
'text-decoration-color': colors[key],
ahmadawais /
Created Dec 5, 2020 — forked from kentcdodds/


I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

ahmadawais / notion2blog.js
Created Nov 3, 2020 — forked from mayneyao/notion2blog.js > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = ""
const START_PAGE = ""
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
ahmadawais / no-follow-back-twitter.js
Created Aug 27, 2020
TWITTER: Remove the followers from twitter following tab to see the people who don't follow you back. Hacky as heck :P
View no-follow-back-twitter.js
document.querySelectorAll("div[role=\"button\"]").forEach(el => {
const follower = /Follows you/g.test(el.textContent);
follower && el.parentNode.parentNode.remove();
ahmadawais / .profile
Created Aug 27, 2020 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
View .profile
# 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
View index.js
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 / .zshrc
Created Jul 26, 2020
🦄 Shades of Purple theme for fzf
View .zshrc
# 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 / .zshrc
Created Jul 3, 2020
manpdf opens man pages as PDF
View .zshrc
# Open man page as PDF.
# USAGE: manpdf cat
function manpdf() {
man -t "${1}" | open -f -a /Applications/
ahmadawais / javascript.json
Last active Jun 29, 2020
VSCode Console Log Snippets
View javascript.json
"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 / getTwitterImage.js
Created Jun 21, 2020
Scrape a twitter image with JavaScript.
View getTwitterImage.js
const cheerio = require('cheerio')
const got = require('got')
const REGEX_IMG_MODIFIERS = /_(?:bigger|mini|normal)\./
const ORIGINAL_IMG_SIZE = '_400x400'
const getAvatarUrl = url =>