Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Skidmore joshskidmore

View GitHub Profile
View img-url-exif.sh
#!/usr/bin/env bash
# Josh Skidmore <josh@josh.sc>
# Basic example of using an HTTP range header to extract EXIF data
# from a JPEG file without having to download the entire image.
# This has no error handling and assumes the EXIF data is embedded
# within the first $KB_TO_DOWNLOAD kilobytes of the image
# Requirements:
# * curl
@joshskidmore
joshskidmore / gpd-p2max-kmonad-config.kbd.hs
Last active Oct 4, 2019
GPD P2Max KMonad Keyboard Config
View gpd-p2max-kmonad-config.kbd.hs
INPUT = LINUX_DEVICE L64 /dev/input/by-id/usb-HAILUCK_CO._LTD_USB_KEYBOARD-event-kbd
OUTPUT = UINPUT_SINK
// "TH" = "tap hold"
// this definition states that tapping the ESC key for < 150ms
// acts as an escape and holding for anything > 150ms generates the ` character
// (which is a common place for the tick character on a US keyboard layout)
@esc = TH 150 esc `
// "MT" = "multi tap"
View synaptics.sh
#!/usr/bin/env bash
echo "Configuring synaptics settings..."
S=synclient
# [man] The LeftEdge, RightEdge, TopEdge and BottomEdge parameters are used to define the edge and corner
# areas of the touchpad. The parameters split the touchpad area in 9 pieces, like this:
# │ │
# │ LeftEdge │ RightEdge
@joshskidmore
joshskidmore / p2max-dsdt-check.sh
Last active Sep 15, 2019
p2max-dsdt-check.sh
View p2max-dsdt-check.sh
#!/usr/bin/env bash
_dmesg=$(dmesg)
bios_version=$(echo -e "$_dmesg" | grep GPD | awk '{ print $9 }')
echo "You are running GPD P2 BIOS version $bios_version"
if [[ "$_dmesg" =~ "20190816" ]]; then
echo "You have the DSDT for v0.23 loaded (joshwiththegoodhair version)"
View keyboard.sh
#!/usr/bin/env bash
export DISPLAY=:0
HARD_RESET=$1
reset_kbd () {
xdotool keyup Shift_L Shift_R Control_L Control_R Meta_L Meta_R Alt_L Alt_R Super_L Super_R Hyper_L Hyper_R ISO_Level2_Latch ISO_Level3_Shift ISO_Level3_Latch ISO_Level3_Lock ISO_Level5_Shift ISO_Level5_Latch ISO_Level5_Lock Caps_Lock 204 205 206 207
@joshskidmore
joshskidmore / gpd-micropc-keyboard.sh
Created Jul 5, 2019
Uses xmodmap + xcape to use the MicroPC's bottom row a bit more efficiently
View gpd-micropc-keyboard.sh
#!/usr/bin/env bash
# resets keyboard; kills all running instances of xcape
reset_kbd () {
local xcape_cnt=$(pgrep xcape | wc -l)
echo " - reset_kbd"
echo " - killing $xcape_cnt instances of xcape"
setxkbmap -layout us
@joshskidmore
joshskidmore / lspci.txt
Created Jul 1, 2019
gpd-micro-lspci-vv
View lspci.txt
00:00.0 Host bridge: Intel Corporation Device 31f0 (rev 03)
DeviceName: Onboard - Other
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
00:00.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant (rev 03)
DeviceName: Onboard - Other
Subsystem: Intel Corporation Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
View ubuntu-mate-gpd-micropc.sh
#!/usr/bin/env bash
# update
apt -y update
apt -y upgrade
apt -y dist-upgrade
# 5.2 mainline kernel
cd /tmp
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2-rc6/linux-headers-5.2.0-050200rc6_5.2.0-050200rc6.201906222033_all.deb
@joshskidmore
joshskidmore / gpd-pocket2-fix-optical-sensor.sh
Created May 22, 2019
gpd-pocket2-fix-optical-sensor.sh
View gpd-pocket2-fix-optical-sensor.sh
#!/usr/bin/env bash
id=$(lsusb.py | grep -i hail | awk '{ print $1 }')
echo "on" | sudo tee /sys/bus/usb/devices/${id}/power/control
@joshskidmore
joshskidmore / wireguard.md
Last active Feb 20, 2019
Wireguard OpenVPN Replacement
View wireguard.md

server setup

[ON SERVER] install wireguard (ubuntu)

sudo add-apt-repository ppa:wireguard/wireguard
sudo apt-get update
sudo apt-get install wireguard-dkms wireguard-tools

[ON SERVER] create wireguard conf