Skip to content

Commit

Permalink
Remove stale content: updates live at ms264556.net
Browse files Browse the repository at this point in the history
  • Loading branch information
ms264556 committed Jan 15, 2024
1 parent cca0c4c commit f76f6d5
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 438 deletions.
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
# Hackery
# [Hackery](https://ms264556.net)

Just hacks and code snippets which might be useful to someone else.
The hacks and guides have moved to [ms264556.net](https://ms264556.net).

## Ruckus Wireless Guides
The github repo is only being used for website comments, issues and notes.

[Push Let's Encrypt certificates to Ruckus Unleashed/ZoneDirector](https://ms264556.net/pages/PfSenseLetsEncryptToRuckus)
## [Ruckus Wireless Guides](https://ms264556.net/ruckus/#guides)

[Connect APs to ZoneDirector over the Internet](https://ms264556.net/pages/ZD1200OpenPfsensePorts)
Configuring certificates and firewalls for Ruckus Unleashed and ZoneDirector

## Ruckus Wireless Hackery
## [Ruckus Wireless Hackery](https://ms264556.net/ruckus/#hackery)

[Change the Country Code on country-locked Ruckus Access Points](https://ms264556.net/pages/RuckusCountryCodeChange)
Extend the functionality or lifespan of your Ruckus AP or ZoneDirectors

[Recovering after a ZoneDirector failure](https://ms264556.net/pages/MigrateDeadZoneDirector)
## [Font Hackery](https://ms264556.net/font/)

[Other Ruckus Wireless Hackery](https://ms264556.net)
Improve the usability of Verdana as a programming font

## Font Hackery
## [Dell Monitor Guides](https://ms264556.net/dell/)

[A tweaked Verdana font for Programming (100% or 125% text scaling version)](pages/VerdanaVisualStudio.md)
Configuring Dell Monitor KVM and PbP/PiP functionality

[A HiDPI-friendly Verdana font alternative for Programming (150%+ text scaling version)](pages/VerdanaRetinaVisualStudio.md)
# Notes

## Dell Monitor KVM Guides
The following tools, plugins and libraries are used (thanks!):-

[Sharing a Bluetooth Keyboard between Linux and Windows](pages/BluetoothKeyboardViaKVM.md)

[Setting up a hotkey to switch between Linux and Windows](pages/InputSwitchHotkey.md)

[Setting up a hotkey to switch Picture-by-Picture On/Off](pages/DellPbPSwitch.md)
* [VitePress](https://vitepress.dev/)
* [vitepress-plugin-comment-with-giscus](https://github.com/T-miracle/vitepress-plugin-comment-with-giscus)
* [@gera2ld/tarjs](https://github.com/gera2ld/tarjs)
Binary file removed images/VSMeiryoUI.png
Binary file not shown.
Binary file removed images/VSVerdana.png
Binary file not shown.
22 changes: 1 addition & 21 deletions pages/BluetoothKeyboardViaKVM.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# Sharing a Bluetooth Keyboard between Linux and Windows

I plug a USB Bluetooth dongle into my Dell monitor, so it follows me from PC to PC.

There's lots of instructions to pair a bluetooth keyboard in Windows then copy the link key to Linux. I need it the other way around: I want to pair the keyboard with my latest Linux install, then copy the link key to my Windows install.

Download `winexe`: this lets me run commands on a remote Windows PC. I've used the version below on several different Ubuntu-based distros:-
```bash
cd ~
wget https://github.com/ms264556/WinEXE-CentOS7/raw/master/winexe
chmod +x winexe
```

Now retrieve the link key and poke it into the Windows PC.
```bash
sudo bash # we can't see the necessary info as an ordinary user

windows_address=192.168.1.248 # change me to the Windows PCs address or hostname
windows_credentials=DOMAIN/USER%PASS # change me to the windows logon (remove DOMAIN/ if the account is local)

cd /var/lib/bluetooth
grep -r -H -A 1 --include=info "\[LinkKey\]" | sed "s/://g ; s~[/=]~ ~g ; s/.*/\L&/g ; s/-key.*/\U&/g" | awk '{getline;print $1 " /v " $2 " /t REG_BINARY /d " $4}' | xargs -I{} ~/winexe --user=$windows_credentials --system //$windows_address 'reg add HKLM\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys\{} /f'
```
This content has [moved](https://ms264556.net/dell/BluetoothKeyboardViaKVM).
51 changes: 1 addition & 50 deletions pages/DellPbPSwitch.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
# Setup Hotkeys to turn PbP On/Off on Dell monitors

This is useful if you want to run a full-screen Teams/Zoom meeting or watch a full-screen video, but leave a panel free for making notes or surfing the internet.

### 1) Download and Install Dell Display Manager (DDM)
Currently here:
* [https://dl.dell.com/FOLDER08877637M/1/ddmsetup2107.exe?fn=ddmsetup2107.exe](https://dl.dell.com/FOLDER08877637M/1/ddmsetup2107.exe?fn=ddmsetup2107.exe)

### 2) Download DDM Hotkey Manager (DDMHKM)
Currently here:
* [http://www.entechtaiwan.com/files/ddmhkm.exe](http://www.entechtaiwan.com/files/ddmhkm.exe)

### 3) Configure the Hotkey

> My example assumes a Dell monitor supporting 80/20 is installed (e.g. U4021QW), and that the PC has 2 cables connected to ports DP1 & HDMI2.
* Run the downloaded `ddmhkm.exe` to start the DDM Hotkey Manager.
* In the _DDM command-line parameters_ box, type `/1:SetPxPMode Off`.
* Click in the _Select system-wide-hotkey_, and press the hotkey combination you want for No-PbP.
* Increment the Hotkey from 0 to 1
* In the _DDM command-line parameters_ box, type `/1:SetPxPMode PBP-2H-82 DP1 HDMI2`.
* Click in the _Select system-wide-hotkey_, and press the hotkey combination you want for 80/20 PbP.
* Close the DDM Hotkey Manager.
* Exit & Restart the Dell Display Manager.

### 4) Fixup the Windows Display Settings

#### 80/20 PbP

* Use your hotkey to turn 80/20 PbP on.
* Go into `Settings` > `System` > `Display`
* Make sure that the Main display and Secondary display are in the correct positions.
* Select the main display
* Make sure `Make this my main display` is ticked.
* Make sure `Extend these displays` is selected (from the button beside `Identify`).
* Make sure `Scale` is set to what you like (e.g. 125%).
* Make sure `Display Resolution` is set correctly (i.e. 4096 x 2160 on a U4021QW).
* Select the 2nd screen
* Make sure `Scale` is set to what you like (e.g. 125%).
* Make sure `Display Resolution` is set correctly (i.e. 1024 x 2160 on a U4021QW).

#### No PbP

* Use your hotkey to turn PbP off.
* Go into `Settings` > `System` > `Display`
* Select the main display
* Make sure `Make this my main display` is ticked.
* Make sure `Show only on 1` is selected (from the button beside `Identify`).
* Make sure `Scale` is set to what you like (e.g. 125%).
* Make sure `Display Resolution` is set correctly (i.e. 5120 x 2160 on a U4021QW).

> Note that after switching to a new layout it will take 10 seconds or so before DDM starts listening to hotkeys again.
This content has [moved](https://ms264556.net/dell/DellPbPSwitch).
86 changes: 1 addition & 85 deletions pages/InputSwitchHotkey.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,3 @@
# Setup Hotkey to Switch Dell monitor between PCs

## Windows PC
### 1) Install Dell Display Manager (DDM)
Currently here:
* [https://dl.dell.com/FOLDER09052092M/1/ddmsetup.exe](https://dl.dell.com/FOLDER09052092M/1/ddmsetup.exe)

### 2) Install DDM Hotkey Manager (DDMHKM)
Currently here:
* [http://www.entechtaiwan.com/files/ddmhkm.exe](http://www.entechtaiwan.com/files/ddmhkm.exe)

### 3) Configure the Hotkey

* Run the downloaded `ddmhkm.exe` to start the DDM Hotkey Manager.
* In the _DDM command-line parameters_ box, type `/1:SetActiveInput HDMI`.
* Click in the _Select system-wide-hotkey_, and press the hotkey combination.
* Close the DDM Hotkey Manager.
* Exit & Restart the Dell Display Manager.

## Linux PC
### 1) Install ddcutil
```bash
sudo bash
```

```bash
apt install ddcutil
```
### 2) Allow runnning of ddcutil without Administrator prompt
```bash
cat <<EOF >/usr/share/polkit-1/actions/sh.fabi.pkexec.ddcutil.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="sh.fabi.pkexec.ddcutil">
<message>Authentication is required to run the ddcutil</message>
<icon_name>CHOOSEAGOODLOGO</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/ddcutil</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
</action>
</policyconfig>
EOF
```
```bash
cat <<EOF >/usr/share/polkit-1/rules.d/49-ddcutil_nopass_tony.rules
polkit.addRule(function(action, subject) {
if (action.id == "sh.fabi.pkexec.ddcutil" && subject.user == "tony") {
return polkit.Result.YES;
}
});
EOF
```


### 3) Create script to Switch Inputs
```bash
cat <<EOF >/usr/local/bin/switch-monitor-to-displayport.sh
#!/bin/bash
pkexec ddcutil setvcp 60 0x0f
EOF
chmod +x /usr/local/bin/switch-monitor-to-displayport.sh
```

> ```60``` is the ddc inputsource, and ```0x0f``` is my monitor's inputsource code for DisplayPort1.
> If you don't know your monitor's inputsource codes the you can [look them up here](https://github.com/ddccontrol/ddccontrol-db/tree/master/db/monitor).
### 4) Setup the Global Hotkey
Varies depending on Linux distro.

For Linux Mint:
* Open Keyboard Settings > Shortcuts > Custom Shortcuts
* Press _Add custom shortcut_ button
* In the _Name:_ box, enter something like `Switch Monitor To DisplayPort`
* In the _Command:_ box, enter `/usr/local/bin/switch-monitor-to-displayport.sh`
* Press the _Add_ button
* In the _Keyboard bindings_ list, click on first `unassigned` slot
* Press the hotkey combination

This content has [moved](https://ms264556.net/dell/InputSwitchHotkey).
2 changes: 1 addition & 1 deletion pages/PfSenseLetsEncryptToRuckus.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Push TLS Certificates to Ruckus ZoneDirector / Unleashed

This content has [moved](https://ms264556.net/pages/PfSenseLetsEncryptToRuckus).
This content has [moved](https://ms264556.net/ruckus/PfSenseLetsEncryptToRuckus).
2 changes: 1 addition & 1 deletion pages/RuckusCountryCodeChange.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bypassing the Country Lock for a US model Ruckus AP

This content has [moved](https://ms264556.net/pages/RuckusCountryCodeChange).
This content has [moved](https://ms264556.net/ruckus/RuckusCountryCodeChange).
2 changes: 1 addition & 1 deletion pages/StandaloneApRootShell.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Obtaining a root shell on Standalone/Solo Ruckus APs

This content has [moved](https://ms264556.net/pages/StandaloneApRootShell).
This content has [moved](https://ms264556.net/ruckus/StandaloneApRootShell).
145 changes: 1 addition & 144 deletions pages/VerdanaRetinaVisualStudio.md
Original file line number Diff line number Diff line change
@@ -1,146 +1,3 @@
# HiDPI Verdana Font for Programming

Verdana is the perfect programming font... but it looks kinda chunky at 150% magnification or above (which is the default for a 27" 4K screen).

Meiryo's latin characters are pretty much identical to Verdana, but with updated hinting which is much improved on HiDPI screens. Unfortunately (for programmers) Meiryo's `\` is replaced with `¥`, and Visual Studio ignores the substitution table entry which would fix this.

So I've created a tweaked font (in FontForge) which puts the correct backslash glyph back.
I also added a => ligature, widened the hyphen, lowered the asterisk, and tweaked the kerning on angle brackets.

<img src="../images/VSMeiryoUI.png" width="1189" />

You probably don't have Meiryo, so from the Optional features Settings (try typing "Manage Optional Features" in the Start menu), add the Japanese Supplemental Fonts.
I accidentally saved the results to https://github.com/ms264556/Hackery/tree/master/images, if you want to save yourself some effort and just grab the fonts.

FontForge needs to run the script which generates the new font:
```Batchfile
fontforge.exe -script vsMeiryo.py
```

Where `vsMeiryo.py` is:
```python
import fontforge
import sys

def unmapGlyph(font, glyphname):
glyph = font[glyphname]
glyph.unicode = -1
glyph.glyphname = ".unmapped" + glyph.glyphname

def modifyFont(font):
# bigger, lowered asterisk
plus = font["plus"]
unmapGlyph(font, "asterisk")
asterisk = font.createChar(0x2A, "asterisk")
asterisk.width = 1446
asterisk.vwidth = plus.vwidth
asterisk.addReference("uniFF0A", psMat.translate(-300, -50))

# remap hyphen-minus from figuredash (which is short and fat) to minus (which is long and skinny)
font["figuredash"].altuni = tuple(
[a[0] for a in font["figuredash"].altuni if a[0] != 0x2D])
minus = font["minus"]
minus.altuni = tuple([a[0] for a in minus.altuni]) + (0x2D,)

# make minus a little shorter
minus.width = 1410
minusContour = fontforge.contour()
minusContour.is_quadratic = True
minusContour.moveTo(1205, 585)
minusContour.lineTo(205, 585)
minusContour.lineTo(205, 733)
minusContour.lineTo(1205, 733)
minusContour.closed = True
minusLayer = fontforge.layer()
minusLayer.is_quadratic = True
minusLayer += minusContour
minus.foreground = minusLayer

# this is a japanese font: use the proper backslash instead of the yen sign
# (there's a substitution table entry to do this, but VS doesn't use it)
unmapGlyph(font, "backslash")
backslash = font["glyph99"]
backslash.unicode = 0x5C
backslash.glyphname = fontforge.nameFromUnicode(backslash.unicode)

# nice looking => glyph
goesTo = font.createChar(-1, ".unmappedgoesto")
goesTo.width = 2412
goesToContour = fontforge.contour()
goesToContour.is_quadratic = True
goesToContour.moveTo(2182, 674)
goesToContour.lineTo(1660, 21)
goesToContour.lineTo(1578, 86)
goesToContour.lineTo(1826, 375)
goesToContour.lineTo(230, 375)
goesToContour.lineTo(230, 523)
goesToContour.lineTo(1938, 523)
goesToContour.lineTo(2056, 672)
goesToContour.lineTo(1959, 795)
goesToContour.lineTo(230, 795)
goesToContour.lineTo(230, 943)
goesToContour.lineTo(1825, 943)
goesToContour.lineTo(1586, 1195)
goesToContour.lineTo(1664, 1265)
goesToContour.closed = True
goesToLayer = fontforge.layer()
goesToLayer.is_quadratic = True
goesToLayer += goesToContour
goesTo.foreground = goesToLayer
goesTo.autoHint()
goesTo.autoInstr()

# ligature so our nice looking => glyph gets used
font.addLookup("ligavs", "gsub_ligature", (),
(("liga", (("latn", ("dflt")),)),))
font.addLookupSubtable("ligavs", "ligavs")
goesTo.addPosSub("ligavs", ("equal", "greater"))

# kern pairs for << >> ||
font.addLookup("kernvs", "gpos_pair", (),
(("kern", (("latn", ("dflt")),)),))
font.addLookupSubtable("kernvs", "kernvs")
font["less"].addPosSub("kernvs", "less", -250)
font["greater"].addPosSub("kernvs", "greater", -250)
font["bar"].addPosSub("kernvs", "bar", -294)

# reencode so our new chars get used
font.reencode("unicode")

def nameFont(font, fontFamily, fontWeight):
font.familyname = fontFamily
fontIsBold = "Bold" in fontWeight
fontIsItalic = "Ital" in fontWeight
font.weight = "Bold" if fontIsBold else "Book"
fontNeedsSuffix = (fontIsBold or fontIsItalic)
font.fontname = font.familyname.replace(
" ", "") + (("-" + fontWeight.replace(" ", "")) if fontNeedsSuffix else "")
font.fullname = font.familyname + \
((" " + fontWeight) if fontNeedsSuffix else "")
font.uniqueid = 0
font.sfnt_names = ((0x409, 1, font.familyname),
(0x409, 2, fontWeight), (0x409, 4, font.fullname))
font.os2_weight = 700 if fontIsBold else 400
font.macstyle = (0x01 if fontIsBold else 0x00) | (
0x02 if fontIsItalic else 0x00)
panose = list(font.os2_panose)
if (panose[2] <= 0x06 and fontIsBold):
panose[2] = 0x08
if (panose[2] > 0x06 and not fontIsBold):
panose[2] = 0x06
if (panose[7] >= 0x02 and panose[7] <= 0x08 and fontIsItalic):
panose[7] += 0x07
if (panose[7] >= 0x09 and panose[7] <= 0x0F and not fontIsItalic):
panose[7] -= 0x07
font.os2_panose = tuple(panose)

def main(argv):
font = fontforge.open("C:\\Windows\\Fonts\\meiryo.ttc(Meiryo UI)")
modifyFont(font)
nameFont(font, "Vs Meiryo UI", "Regular")
font.generate(font.fontname + ".ttf")
font.close()

if __name__ == '__main__':
main(sys.argv[1:])
```
This content has [moved](https://ms264556.net/font/VerdanaRetinaVisualStudio).
Loading

0 comments on commit f76f6d5

Please sign in to comment.