Skip to content

Instantly share code, notes, and snippets.

@ohnit
ohnit / scrapingFigmaComments.js
Last active May 27, 2025 17:35
Scrape comments from Figma
/**
For when you only have 'viewer' access to a Figma project, but you'd really like a csv with all the top-level comments. Replies are not included.
The csv columns will be: "Identifier", "Author", "Message"
## To use:
Paste this code into your browser's devtools.
Creater a new scraper:
@ohnit
ohnit / git-delete-remote-branches
Created June 2, 2023 15:09
git-delete-remote-branches
#! /bin/bash
set -e -o pipefail
# Interactive script for deleting remote branches. Focused on branches left over
# when someone else merged or squash-merged a pull request, but did not delete
# the remote branch.
#
# Presents remote branches for a repo, one at a time. So you can decide whether
# to delete them.
@ohnit
ohnit / using_elixir_with_debugging_proxy.md
Created March 30, 2023 16:34
Using a Debugging Proxy with Elixir

Using a Debugging Proxy with Elixir

You can use a debugging proxy (such as ProxyMan or Charles Proxy) to see outgoing calls coming from your Elixir project. Unfortunately, Elixir doesn't look at your system's proxy settings, so you have to set the proxying manually in your networking library. Here I am using Tesla with Hackney.

use Tesla

adapter(Tesla.Adapter.Hackney, proxy: {"localhost", 9090}, ssl_options: [{:verify, :verify_none}])

# plug Tesla.Middleware.Compression
### Keybase proof
I hereby claim:
* I am ohnit on github.
* I am ohnit (https://keybase.io/ohnit) on keybase.
* I have a public key whose fingerprint is 4685 5F5C C0CC 7222 50DD 103D 38E3 D2C5 35A3 8165
To claim this, I am signing this object:
@ohnit
ohnit / disable_educative_notetaking.js
Created February 28, 2021 15:12
Turn off selection popup on Educative.io
// ==UserScript==
// @name Turn off educative notetaking
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove popup when you select text
// @author ohnit
// @match https://www.educative.io/courses/*
// @grant none
// ==/UserScript==
@ohnit
ohnit / hush-for
Created January 18, 2021 18:30
Turn on 'Do Not disturb' for a time period on macOS
#!/bin/bash
# See `showUsage` for desciption
# requires `gsed` via `brew install gnu-sed`
# requires `dnd` via `npm install --global do-not-disturb-cli`
function showUsage() {
cat <<EOS
Usage: $(basename "${0}") "<time_description>"
@ohnit
ohnit / elixir-check
Last active January 9, 2024 16:27
Diffs credo and dialyzer outputs with the output saved when it was run on the last commits
#! /bin/bash
# Diffs credo and dialyzer outputs with the output saved when it was run on the last commits
DIFF_TOOL="code --diff"
EDITOR="code"
check_dirty() {
if [ -n "$(git status --porcelain)" ]; then
echo true
# Recurses a json object and creates a list of breadcrumbs strings
#
# For example:
# jq '.stuff | breadcrumbs(.children?; .name)'
# This will recurse in every object containg a "children" key and for each object
# found, it will add its "name" field to the breadcrumb trail
#
# Parameters:
# - get_children: function which given an object, should return array of its children
# - get_name: function which given an object, should return a string to be added to the breadcrumb trail
@ohnit
ohnit / git-clean-merged_old
Created February 25, 2020 18:18
Delete local git branches that have been merged
#! /bin/bash
# deletes branches (other than `master` or `develop`) that have already been merged into your
# current branch. I prefer this: https://gist.github.com/ohnit/150cb10459328e4695956567da5840b8
confirm() {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
@ohnit
ohnit / git-clean-merged
Last active September 14, 2022 14:18
Clean up local git branches that have been deleted on remote
#! /bin/bash
# deletes local branches that have been deleted on remote
# this version requires that `git fetch -p` is used to prune remote branches from your local repo
declare force
force=false
if [ $# -gt 0 ]; then