Skip to content

Instantly share code, notes, and snippets.

View Uplink03's full-sized avatar

Uplink03

  • London, United Kingdom
View GitHub Profile
@Uplink03
Uplink03 / 40-libinput.conf
Created September 7, 2018 21:10
Apple Mouse Natural Scroll, Ubuntu 18.04
# /etc/X11/xorg.conf.d/40-libinput.conf
Section "InputClass"
Identifier "Apple Magic Mouse"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
MatchProduct "My Apple Mouse" # Get this from `xinput`
Driver "libinput"
Option "NaturalScrolling" "true"
EndSection
@Uplink03
Uplink03 / ebay-sorting.js
Created January 4, 2019 01:53
eBay: better sorting
// I once suggested this to eBay, and they said they'll take my feedback into account, but nothing came out of it, so I made my own
// How to use: create bookmarks in your Bookmark Toolbar with the following content in your browser
// eBay: Auction
// this will select "Auction" and "Ending soonest" in one click
// bookmark location
javascript:x=new URL(window.location);x.searchParams.set('LH_Auction','1');x.searchParams.delete('LH_BIN');x.searchParams.set('_sop','1');window.location=x.toString();
@Uplink03
Uplink03 / memory-job.psm1
Created January 22, 2020 17:09
Replacement for Powershell Start-Job that doesn't spawn subprocesses
# Based on code at https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/a-better-and-faster-start-job
$code = @'
using System;
using System.Collections.Generic;
using System.Text;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
namespace InProcess
{
@Uplink03
Uplink03 / StaticValetDriver.php
Created May 21, 2020 15:38
Laravel, Valet static file driver
<?php
/*
* To enable serving of static files (i.e. bypass the Laravel front controller)
* Save this as: $HOME/.config/valet/Drivers/StaticValetDriver.php
*/
class StaticValetDriver extends ValetDriver
{
/**
@Uplink03
Uplink03 / formrequest.template.php
Created July 7, 2020 18:27
Quick and Dirty FormRequest code generator
<?php declare(strict_types=1);
namespace $NAMESPACE$;
use Illuminate\Foundation\Http\FormRequest;
class $CLASS_NAME$ extends FormRequest
{
public function authorize(): bool
{
@Uplink03
Uplink03 / wickes-plaster-watch.bash
Last active July 7, 2020 20:04
Get Wickes stocks for plaster
curl -s --location --request POST 'https://www.wickes.co.uk/store-pickup/220056/pointOfServices' \
--form 'stockFilter=on' \
--form 'latitude=51.5089281' \
--form 'longitude=-0.0221774' \
--form 'locationQuery=' \
--form 'cartPage=false' \
--form 'entryNumber=0'|grep 'drawMapWithStores(' |
sed -E 's/^.*drawMapWithStores\((.*)\);/\1/g' |
jq -r '.storeSearchPageData.results[] | ("Stock: \(.stockData.stockLevel)", "Description: \(.description)", "Distance: \(.formattedDistance)", "----")'
@Uplink03
Uplink03 / dw2102.patch
Last active August 12, 2021 22:00
Kernel Oops dw2102
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index 346946f..0aa19cd 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -2425,18 +2425,20 @@ static void dw2102_disconnect(struct usb_interface *intf)
struct dw2102_state *st = (struct dw2102_state *)d->priv;
struct i2c_client *client;
- /* remove I2C client for tuner */
- client = st->i2c_client_tuner;
@Uplink03
Uplink03 / natural-mouse.ps1
Last active September 22, 2022 00:34
Set mouse natural scrolling in Windows with PowerShell
# This script can be used to enable Natural Scrolling on USB mice in Windows
# You don't have to run the script as Administrator, but if you do then the script will
# offer to edit the Registry for you - it won't make any changes without your approval.
# After editing the Registry, remove the mouse from the USB port, and plug it back in.
# If that doesn't work, you may have to reboot.
# In my case, I was able to just unplug and plug the mouse back in without even as much as logging out.
# I did this on Windows 11, but it should work just fine on Windows 10 too.
@Uplink03
Uplink03 / ASUS-Vivobook-keyboard.md
Last active September 14, 2022 00:41
Asus Vivobook keyboard light tweaks

The trouble

ASUS claims that there's no way to leave the keyboard backlight always on. Their reasons? Power consumption. I mean, I only have an 8 core CPU and a RTX 3050 Ti in here, but it's the keyboard they're worried about...

Information

I found a YouTube video with instructions, but it doesn't match my registry: https://www.youtube.com/watch?v=5eXD_PMJK4M

The video says the registry path is this:

@Uplink03
Uplink03 / bash-programming-showcase.bash
Created September 15, 2022 23:55
Bash programming(!) language
#!/bin/bash
# This file is supposed to give you a quick idea about what Bash can do beyond its regular job as a shell or scripting language.
# Bash is more than a scripting language. It's a half-decent programming language. It's snail slow, but half-decent otherwise.
# While it's very archane for such usage, it can be a good substitute for Perl and Python in a pinch.
# These things won't work on cut down shells (e.g. sh, ash, dash), and may explode on ZSH, which has its own,
# somewhat friendlier(!), more modern(!) ways of doing these things.
# Remember kids: always quote your variables in Bash! You're almost certainly expecting them to expand