Skip to content

Instantly share code, notes, and snippets.

Shourai / Nightshift mac
Last active Mar 29, 2017
Nightshift on unsupported macs
View Nightshift mac
This was written by Ryanmcv over at
1. Disable System Integrity Protection by booting into Recovery mode (hold down Command + R during boot-up), opening Terminal, and typing csrutil disable
2. Restart your Mac and open Finder. Navigate to System/Library/PrivateFrameworks/
Make a copy of the entire CoreBrightness.framework folder (save it to your desktop or a similar place).
3. In Xcode, open the copy of CoreBrightness.framework that you just created. File > Open; Browse to where you just saved CoreBrightness.framework; from within that .framework folder, choose the CoreBrightness icon at the top that looks like a shortcut.
4. In Xcode, press Shift + Command + J on your keyboard. A navigation column will appear on the left-hand side. Secondary/right-click CoreBrightness at the top of that column and choose Open As > Hex.
View gist:accc11173a8320c53314311b7fb6676c
## enable changes inside brackets e.g. <di+)>, <ci+[>
# autoload -U select-bracketed
# autoload -U select-quoted
# zle -N select-quoted
# zle -N select-bracketed
# for km in visual viopp; do
# bindkey -M $km -- '-' vi-up-line-or-history
# for c in {a,i}${(s..)^:-\'\"\`\|,./:;-=+@}; do
# bindkey -M $km $c select-quoted
# done
Shourai / Raspberry Pi headless
Last active Oct 15, 2017
Raspberry Pi headless installation
View Raspberry Pi headless

SSH over USB

To edit files on a raspberry pi when you are unable to mount ext4 disks, it is possible to enable SSH over USB. This is also useful if you do not have any peripherals you can attach to the pi. If however you are running linux you can directly edit /etc/wpa_supplicant/wpa_supplicant.conf, etc/network/interfaces and /etc/dhcpcd.conf.

Enable SSH

There was a security update to the Raspian images. To enable ssh you need to put a blank ssh file in the boot directory.

Shourai / Jailbroken Kindle Upgrade Instructions
Last active Oct 10, 2018
Jailbroken Kindle Upgrade Instructions
View Jailbroken Kindle Upgrade Instructions
1. Copy system upgrade file to main directory of Kindle.
2. Disconnect Kindle from computer.
3. Go to the main menu, settings, device options, update your kindle.
4. After the update/restart plug the kindle back into the computer
5. Copy Screensaver and Python update files into the mrpackages folder and eject kindle
(Files can be found here:
6. enter `;log mrpi` into the search box.
6. install the packages via KUAL if that is working.
Shourai / git prompt in zsh
Last active Oct 18, 2018
git prompt in zsh
View git prompt in zsh
# Adapted from
# PROMPT='%~ ❯ '
setopt prompt_subst
autoload -U colors && colors # Enable colors in prompt
# Echoes a username/host string when connected over SSH (empty otherwise)
ssh_info() {
[[ "$SSH_CONNECTION" != '' ]] && echo "%(!.%{$fg[red]%}.%{$fg[yellow]%})%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:" || echo ""
Shourai / Keeping a fork up to date
Last active Oct 18, 2018 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date
View Keeping a fork up to date
### 1. Clone your fork:
git clone
### 2. Add remote from original repository in your forked repository:
cd into/cloned/fork-repo
git remote add upstream git://
git fetch upstream
Shourai / How to delete a commit in git, local and remote
Created Oct 29, 2018
How to delete a commit in git, local and remote
View How to delete a commit in git, local and remote
It has happened to me more than once that I make a commit without verifying the changes I am committing. Time after that I review the commit and I notice that there is something in the commit that doesn’t belong there.
In those times what I want to do is make a patch with the changes of the commit, delete the commit, apply the patch and then redo the commit only with the changes I intended. In this post I will only explain how to delete a commit in your local repository and in a remote repository in case you have already pushed the commit.
Delete a local commit
Anthony Dentinger showed me in the comments that you can delete a local commit by doing:
git reset –hard HEAD~
Shourai / Controlling PWR and ACT LEDs on the Raspberry Pi
Created Nov 2, 2018
Controlling PWR and ACT LEDs on the Raspberry Pi
View Controlling PWR and ACT LEDs on the Raspberry Pi
March 15, 2015
All Raspberry Pi models have a few built-in LEDs; the earlier models had PWR, ACT, and networking status LEDs all lined up on the board itself; for the B+ and model 2 B, the networking LEDs moved onto the network jack itself, leaving just two LEDs; PWR (a red LED) and ACT (a green LED).
Normally, whenever the Pi is powered on—except if the power supply dips below something like 4.5VDC—the red PWR LED remains lit no matter what. If you wanted to 'disable' the LED, you'd have to put a piece of tape or something else over the LED, or get out a soldering iron and modify the hardware a bit.
Raspberry Pi model 2 B, B+ and A+
Luckily, with the Pi 2 model B, B+, A+, and Zero, you can control the LEDs in software, in a few different ways. The simplest way to change the way these LEDs work is to modify the trigger for each LED by setting it in /sys/class/leds/led[LED_ID]/trigger, where you replace [LED_ID] wi

Keybase proof

I hereby claim:

  • I am Shourai on github.
  • I am shourai ( on keybase.
  • I have a public key whose fingerprint is 5EAC 6DD6 CB6A 24BF D337 965F D929 E4C2 C221 663A

To claim this, I am signing this object:

Shourai /
Created Nov 24, 2019 — forked from kylemanna/
Connmanctl Cheat Sheet