Skip to content

Instantly share code, notes, and snippets.

View ipatch's full-sized avatar
🔌
going to be out of the office AFK today TUESDAY 👷

Chris ipatch

🔌
going to be out of the office AFK today TUESDAY 👷
View GitHub Profile
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active March 26, 2026 21:24
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@zer4tul
zer4tul / weechat.md
Last active April 16, 2026 03:16
A Simple, Base16 Friendly, Weechat Setup

A Simple, Base16 Friendly, Weechat Setup

Scripts

  • Some must-have scripts
  /script install buffers.pl buffer_autoclose.py iset.pl go.py colorize_nicks.py
@menski
menski / i3status.py
Created August 10, 2014 21:00
i3 status extension script which adds fan and governor info
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script is a simple wrapper which prefixes each i3status line with custom
# information. It is a python reimplementation of:
# http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.pl
#
# To use it, ensure your ~/.i3status.conf contains this line:
# output_format = "i3bar"
# in the 'general' section.
@nwjlyons
nwjlyons / laptop_fan.sh
Last active July 13, 2023 10:05
Manually control Mac Book Pro laptop fan from linux
# First su in as root
sudo su
# Then set fan control to manual mode
echo 1 > /sys/devices/platform/applesmc.768/fan1_manual
# Then set the fan speed to any value between fan1_min and fan1_max. To view these values
cat /sys/devices/platform/applesmc.768/fan1_min
cat /sys/devices/platform/applesmc.768/fan1_max
@nwjlyons
nwjlyons / common.sh
Last active September 5, 2021 22:21
Instructions on how to wire up your MacBook Pro function keys to control your laptop hardware in Crunchbang
#! /bin/bash
case $1 in
up)
TOTAL=`expr $CURRENT + $INCREMENT`
if [ $TOTAL -gt $MAX ]; then
exit 1
fi
echo $TOTAL > $FILE
;;
@adam-p
adam-p / Local PR test and merge.md
Last active April 19, 2026 06:59
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@0xbb
0xbb / README.md
Last active August 3, 2025 16:19
Macbook Pro 11,3 - Linux - AppleMuxControl reverse engineering
@azadkuh
azadkuh / vim-cheatsheet.md
Last active June 8, 2026 05:58
vim / vimdiff cheatsheet - essential commands

Vim cheat sheet

Starting Vim

vim [file1] [file2] ...

@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 2, 2026 06:35
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@lestoni
lestoni / gist:8c74da455cce3d36eb68
Last active June 13, 2026 20:51
vim folding cheatsheet

via (https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun)

  • zf#j creates a fold from the cursor down # lines.
  • zf/string creates a fold from the cursor to string .
  • zj moves the cursor to the next fold.
  • zk moves the cursor to the previous fold.
  • zo opens a fold at the cursor.
  • zO opens all folds at the cursor.
  • zm increases the foldlevel by one.
  • zM closes all open folds.