Skip to content

Instantly share code, notes, and snippets.

View joshskidmore's full-sized avatar

Josh Skidmore joshskidmore

View GitHub Profile
@joshskidmore
joshskidmore / img-url-exif.sh
Last active February 15, 2024 15:14
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 / ubuntu-mate-gpd-micropc.sh
Created June 28, 2019 10:43
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-p2max-kmonad-config.kbd.hs
Last active October 4, 2019 19:07
GPD P2Max KMonad Keyboard Config
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"
@joshskidmore
joshskidmore / synaptics.sh
Created October 4, 2019 00:18
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 September 15, 2019 16:16
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)"
@joshskidmore
joshskidmore / gpd-micropc-keyboard.sh
Created July 5, 2019 14:56
Uses xmodmap + xcape to use the MicroPC's bottom row a bit more efficiently
#!/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 / keyboard.sh
Created August 27, 2019 09:51
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 / lspci.txt
Created July 1, 2019 11:34
gpd-micro-lspci-vv
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-
@joshskidmore
joshskidmore / gpd-pocket2-fix-optical-sensor.sh
Created May 22, 2019 18:35
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 February 20, 2019 21:32
Wireguard OpenVPN Replacement

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