Skip to content

Instantly share code, notes, and snippets.

View riotrah's full-sized avatar
:shipit:
[REDACTED]

Rayat Rahman riotrah

:shipit:
[REDACTED]
View GitHub Profile
@mdgrs-mei
mdgrs-mei / ShellIntegration.ps1
Last active May 12, 2024 03:36
Adds escape codes to the prompt for the shell integration
# Reference:
# https://devblogs.microsoft.com/commandline/shell-integration-in-the-windows-terminal/
param
(
[ValidateSet('WindowsTerminal', 'ITerm2')]
[String]$TerminalProgram = 'WindowsTerminal'
)
# Restore hooked functions in case this script is executed accidentally twice

Karabiner layouts for symbols and navigation

Gavin Sinclair, January 2022

Introduction

I use Karabiner (configured with Gosu) to make advanced key mappings on my Apple computer. Karabiner allows you to create “layers”, perhaps simulating those on a programmable mechanical keyboard. I make good use of these layers to give me easy access (home-row or nearby) to all symbols and navigational controls, and even a numpad.

The motivation is to keep hand movement to a minimum. Decades of coding on standard keyboards has unfortunately left me with hand and wrist pain. I will soon enough own a small split keyboard which will force me to use layers to access symbols etc., so this Karabiner solution, which has evolved over months, is a training run for that.

@rsteube
rsteube / a_pragmatic_approach_to_shell_completion.md
Last active April 7, 2023 17:35
A pragmatic approach to shell completion

The rise of new shells

One of the biggest improvements to my terminal experience was the switch from [Bash] to [Zsh]. The reason for this is the astonishing amount of completions provided by the community. As well as something I didn't know of before: menu completion. A mode where you can cycle through the possible values. But like [vim] [Zsh] is quite tough on new users.

Then there was [Fish]. A shell that is more accessible to new users and thus calls itself friendly. But one major catch: the break from [POSIX]. This is actually a good thing yet the lack of completions at the time prevented me to make the switch.

Now there is a new generation of shells that allow passing structured data through a pipe. This is a major thing and well worth its own article.

(defn- attach
"Takes a function to clone and a map of CSF related values
including:
- :args
- :arg-types
- :parameters
These are then properly named and assigned to the template prototype
@TechDufus
TechDufus / Test-PowerShellProfilePerformance.ps1
Last active September 5, 2022 21:27
Test PowerShell Profile Performance
<#
.SYNOPSIS
Perform a benchtest of your PowerShell profile.
.DESCRIPTION
Load Powershell (or Preview) X number of times with NO profile, and with profile, and compare the average loading times.
.PARAMETER Count
Specify the number of consoles to load for testing.
.PARAMETER Preview
Specify whether to test again pwsh-preview or not.
With this present, the tests will use pwsh-preview.
@roman01la
roman01la / analyze.clj
Created March 18, 2021 01:42
analyzing unused and undefined re-frame subscriptions via clj-kondo
(ns analyze.core
(:require [clj-kondo.core :as clj-kondo]
[clojure.set :as set]))
;; checks re-frame's :<- syntax
;; to mark dependency subscriptions as used
(def analyze-reg-sub
"(require '[clj-kondo.hooks-api :as api])
(fn [{node :node}]
(let [[_ kw & children] (:children node)
@christoph-frick
christoph-frick / Awesome-Fennel.md
Last active May 8, 2024 21:15
Use fennel to write the awesome-wm config

How to write an awesome-wm config with Fennel

Awesome-WM is a X11 window manager, that is configured via Lua. Fennel is a Lisp for Lua. This shows a general setup of how to write your awesome-wm config using fennel directly without the compilation step (which would also work, but is not needed).

General setup

Fetch a recent Fennel version (the

@alyssais
alyssais / vpn
Created May 8, 2018 17:12
A tiny command line interface to Viscosity
#!/usr/bin/env bash
run_list() {
osascript <<OSA
tell application "Viscosity"
repeat with theConnection in connections
set theName to name of theConnection
set theState to state of theConnection
log theName & ": " & theState
end repeat

Get/set ID3 meta tags using ffmpeg

A quick guide on how to read/write/modify ID3 metadata tags for audio / media files using ffmpeg.

FFmpeg has a free-form command line option that allows the user to specify key-value-pairs for encoding metadata. Let's take a look.

1. Read ID3 metadata

To list all global metadata tags for a media file, just set an input but no output file.

@cheeaun
cheeaun / horizontal-scroll.ahk
Created August 4, 2009 03:18
AutoHotkey: Shift + Wheel for horizontal scrolling
; Shift + Wheel for horizontal scrolling
+WheelDown::WheelRight
+WheelUp::WheelLeft