Skip to content

Instantly share code, notes, and snippets.

@Shourai
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
from https://ncona.com/2011/07/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
Shourai / Mount SD Cards within VirtualBox on Mac OS X
Created Nov 2, 2018
Mount SD Cards within VirtualBox on Mac OS X
View Mount SD Cards within VirtualBox on Mac OS X
From: https://blog.lobraun.de/2015/06/06/mount-sd-cards-within-virtualbox-on-mac-os-x/
Mount SD Cards within VirtualBox on Mac OS X
Sometimes you need to mount your SD cards inside a VirtualBox machine to work with the files on the card. Working with the Raspberry Pi SD card on Mac OS X is an example for this.
My Raspberry Pi runs on Linux with some version of the EXT file system. While there is some support for this on Mac OS X, the available solutions have a lot of limitations, especially when it comes to write support on EXT file systems. As I do not have an USB keyboard, I sometimes need to mount the filesystem on another system to fix a startup problem when some of my experiments go wrong.
VirtualBox in theory allows for passing the internal card reader of the MacBooks to the virtual machine. Unfortunately, this does not work for me (and it seems for many other people).
@Shourai
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
From: https://www.jeffgeerling.com/blogs/jeff-geerling/controlling-pwr-act-leds-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
View keybase.md

Keybase proof

I hereby claim:

  • I am Shourai on github.
  • I am shourai (https://keybase.io/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
Shourai / connmanctl.md
Created Nov 24, 2019 — forked from kylemanna/connmanctl.md
Connmanctl Cheat Sheet
View connmanctl.md
@Shourai
Shourai / TrueColour.md
Created Apr 4, 2020 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)