Skip to content

Instantly share code, notes, and snippets.

@cweave
cweave / create_sessions.scpt
Created March 24, 2022 03:53
Automating iTerm2 with Applescript
#!/usr/bin/osascript
tell application "iTerm2"
# Open window in full screen
tell application "System Events"
keystroke "f" using {control down, command down}
end tell
set serverSession to current session of current window
tell serverSession
@blopa
blopa / how-to-get-the-redux-state-from-a-production-build-via-the-browser's-console-script-2.js
Last active April 2, 2025 20:50
Code for post "How to get the Redux State from a production build via the browser's console"
// Traverse a dom element
const stores = new Set();
const traverse = (element) => {
let store =
element?.memoizedState?.element?.props?.store
|| element?.pendingProps?.store
|| element?.stateNode?.store;
if (store) {
stores.add(store);
@infused-kim
infused-kim / ls_colors_gen.py
Last active April 17, 2023 01:30
Exa LS_COLORS theme generator
#!/usr/bin/env python
#
# What is this:
# This script generates an LS_COLORS theme.
#
# By default it is using the same colors as the ls replacement exa. The
# purpose is to generate an LS_COLORS theme that is consistent with exa's
# colors so that it can be used by other tools like fzf.
#
@sts10
sts10 / rust-command-line-utilities.markdown
Last active August 14, 2025 14:16
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@b0gdanw
b0gdanw / DisableBigSur.sh
Last active August 1, 2025 13:50
Disable Big Sur services
#!/bin/zsh
#Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
#Disabling unwanted services on macOS 11 Big Sur (11) and macOS Monterey (12)
#Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
#Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist
# user
TODISABLE=()
# frozen_string_literal: true
class RateLimiter
class Error < StandardError; end
class UnknownIntervalError < RateLimiter::Error; end
class WaitTimeError < RateLimiter::Error; end
attr_reader :bucket_name, :interval, :maximum_wait_time, :rate, :redis
def initialize(bucket_name, options = {})
# frozen_string_literal: true
# @see https://gist.github.com/commitshappen/5928740df2e01f256778c2dbd14364a5 for the RateLimiter
module RateLimitable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def rate_limiter(bucket_name, global: {}, local: {})
module Middleware
class BasicMiddleware
def initialize(app)
@app = app
end
def call(env)
# Before the app is called.
status, headers, response = @app.call(env)
# After the app is called.
@christophberger
christophberger / futures.go
Last active November 28, 2022 07:42
Code from appliedgo.net/futures
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan int)
@Konfekt
Konfekt / git-diff.md
Last active August 23, 2024 10:14
git diff common binary files