Skip to content

Instantly share code, notes, and snippets.

@Shourai
Shourai / namecheap SSL.md
Created October 21, 2017 12:49
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@Shourai
Shourai / Mount SD Cards within VirtualBox on Mac OS X
Created November 2, 2018 11:00
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 / Allowing SSH on a server with an active OpenVPN client.md
Last active October 5, 2023 06:32
Allowing SSH on a server with an active OpenVPN client

If you want to SSH to a VPS which is running openVPN do the following:
source: https://serverfault.com/questions/659955/allowing-ssh-on-a-server-with-an-active-openvpn-client

Enable

The problem is that the default gateway gets changed by OpenVPN, and that breaks your current SSH connection unless you set up appropriate routes before you start OpenVPN.

What follows works for me. It uses iptables and ip (iproute2). Below, it is assumed that the default gateway interface before OpenVPN is started is "eth0". The idea is to ensure that when a connection to eth0 is made, even if eth0 is not the default gateway interface anymore, response packets for the connection go back on eth0 again.

You could use the same number for the connection mark, firewall mark and routing table. I used distinct numbers to make the diffences between them more apparent.

@Shourai
Shourai / YouTube_to_Newsboat.py
Created July 21, 2023 20:38
Convert YouTube takeout to newsboat RSS feed
from zipfile import ZipFile
import csv
import os
def find_file():
for file in os.listdir("./"):
if file.endswith(".zip"):
return file
@Shourai
Shourai / Android platform tools
Created January 8, 2017 20:51
Latest android platform tools (ADB and Fastboot) Raw
Ever wanted to download adb or fastboot without having to download the whole of Android Studio?
...but didn't want to download executables from some random warez site?
Good news this week:
https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
@Shourai
Shourai / adb.sh
Last active August 19, 2020 08:34 — forked from olivier-m/adb.sh
Remove all Google apps from an android phone/tablet (Nexus 5 / Nexus 9 | Marshmallow 6.0.1).
# With your phone in debug mode, etc.
adb start-server
adb remount
adb shell < remove.sh
@Shourai
Shourai / TrueColour.md
Created April 4, 2020 17:21 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

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)
@Shourai
Shourai / connmanctl.md
Created November 24, 2019 13:52 — forked from kylemanna/connmanctl.md
Connmanctl Cheat Sheet

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 / Controlling PWR and ACT LEDs on the Raspberry Pi
Created November 2, 2018 11:09
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