Skip to content

Instantly share code, notes, and snippets.

View chazdky's full-sized avatar

Chaz Davis chazdky

View GitHub Profile
@Ujang360
Ujang360 / start-tmux.py
Created October 19, 2019 13:20
Start TMUX Prompt
#!/usr/bin/python3
import libtmux
import subprocess
import os
def create_new_session(tmux_server: libtmux.Server):
user_answer = input("Input session name: ")
tmux_server.new_session(session_name=user_answer)
@hamidzr
hamidzr / sof-audio-setup-carbonx1.sh
Last active June 2, 2023 01:43
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7) might be all you need.
#!/bin/bash
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823
# Prereq: Install Linux 5.3 or newer
@sundowndev
sundowndev / GoogleDorking.md
Last active April 18, 2025 18:08
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"

MCP23008 Button input Board

This board has like.. a bunch of buttons on it. It is controlled by the MCP23008E/P I2C I/O Expander.

It supports configurable 3 bit i2c addresses and allows upto 8 devices on the i2c bus.

The datasheet for the IC can be found on the Microchip website

Pictures

The IC

--[[
rofi.lua - rofi-powered menus for awesome wm
Usage:
rofi = require("rofi")
change width (optional, default 500px):
rofi.width=300
bind to key:
@g0xA52A2A
g0xA52A2A / Vim_autoreply.md
Last active June 4, 2023 23:30
Vim autoreply

A modified version of Romain's gist.

See prior revisions for functionality closer to the original. This is now a simplification that aims only to provide prompts that would typically follow basic commands.

function! ExpandCommand(pattern) abort
  let aliases =
 \ { 'cn' : 'cnext'
@romainl
romainl / grep.md
Last active March 23, 2025 22:59
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

An introduction to alternative keyboard layouts

This is a post to satisfy your curiosity about alternative keyboard layouts, why some people use them, and whether they're for you. It is intended to discuss the topic in broad terms, but I will share my personal preferences towards the end. Due to time constraints and my own limited knowledge, I will focus on layouts optimized for the English language (ANSI variants, with an occasional nod to ISO).

First off, it's important to understand how much debate there is about how we got here: I will not even attempt to settle the issue of who invented the 'first' typewriter layout, because the modern device had many predecessors going back centuries. The usual legend of typewriter evolution holds that American Christopher Latham Sholes debuted the typewriter in 1868 with a 2-row layout that was (nearly) alphabetical. A horizontal stagger between the rows made room for the lever arms attached to each key:


 3 5 7 9 N O P Q R S T U V W X Y Z
2 4 6 8 . A B C D E
@marcwjj
marcwjj / mosh-setup-guide.md
Last active February 19, 2025 05:35
Step by step guide to setup mosh ssh client to Google Cloud VM instance

A beginner's guide to setup Mosh roaming terminal on Mac to access Google Cloud Compute Engine instance

Being new to training ML models using Google Cloud VM instances, I faced issues where my ssh connection to the cloud instance (using either the clound web-based ssh client or using cloud shell) would disconnect from time to time (for example when I power off my laptop or the network gets disconnected) which would terminate the model training process. Therefore I searched for a ssh client that can handle disconnection and can resume connection without disrupting the process running on the server and came across with Mosh mobile shell, a remote terminal app that supports roaming.

It took me a while to figure out how to set up a third party ssh terminal using the google cloud OAuth. Here's a step-by-step guide:

Update: a simpler alternative for persisting remote sessions

Since this writing, another Mosh user kindly advised me that using terminal multiplexer co

if &compatible
set nocompatible
endif
filetype off
" append to runtime path
set rtp+=/usr/share/vim/vimfiles
" initialize dein, plugins are installed to this directory
call dein#begin(expand('~/.cache/dein'))
" add packages here, e.g:
call dein#add('arakashic/chromatica.nvim')