Renamed repo, made this standalone for FirefoxSidebar files

This commit is contained in:
Macleod Sawyer 2021-12-22 11:56:13 -06:00
parent a3666ad9d3
commit e9103c40d6
17 changed files with 3 additions and 316 deletions

View file

@ -1,11 +0,0 @@
# Linux Utilities*
Various linux utility scripts I often have to rewrite a thousand times until I decide they need to just be saved somewhere.
This includes my custom Firefox Dynamic Tab library, which will work on OSX/Windows platforms.
-----
I also have a [/rust-utils/](https://github.com/drannex42/rust-utils) repo that should be merged here, but I haven't done that yet for some unknown reason.
*ᴍsᴛ ᴡᴏʀᴋ ᴡɪᴛʜ Wɪɴᴅs ᴀɴᴅ OSX ᴀs ᴡᴇʟʟ

View file

@ -1,11 +0,0 @@
# Android Utils
## Remove empty gesture space below keyboards
Requires ADB and USB
``` adb shell wm overscan 0,0,0,-75```
## Fullscreen apps
This will turn any specific package into a fullscreen app, this eample uses firefox.
```adb shell settings put global policy_control immersive.full=org.mozilla.fenix```

View file

@ -1,9 +0,0 @@
# Android Development Utils
## Gradle Sync failed
This was a nightmare to figure out, especially because all the error message said was ``Grade sync failed: reason unknown``, so whoever got to write that error message, I am coming for you.
To fix this was a lot of trial-and-error, (and uninstalling and reinstalling Android Studio and removing my .gradle folder in my home directory) and reading and trying a lot of responses on basically all stackoverflow questions answer with "Do this thing that worked eight years ago, or this that worked five years ago, three years ago, and two years ago" and none of those work for now.
**Here is what works in 12021:** Go to ```Tools => SDK Manager => SDK Tools``` Then check the `Google Play Licensing Library` item, and click apply (this installs it - all 73kb to make up for an hour of headaches....). Click on the 'elephant icon' in the top right of Android Studio and your gradle build should be working properly.

View file

@ -1,11 +0,0 @@
# Bluetooth
```bash
hcitool scan # to get the MAC address of your device
bluetoothctl
agent on
scan on # wait for your device's address to show up here
scan off
trust MAC_ADDRESS
pair MAC_ADDRRESS
connect MAC_ADDRESS
```

3
firefox/README.md Normal file
View file

@ -0,0 +1,3 @@
# This repo has been renamed to FirefoxSidebar
Redirect should be automatic, and all files can bve found at the root of this repo.

View file

@ -1,10 +0,0 @@
# Gnome Config
Yes, I know I am incredibly lame by using Ubuntu and Gnome (Ubuntu flavor) as my default DE and OS - but after trying them all, distro jumping every few months (or days...), and dealing with all the security issues and misplaced configs - Ubuntu really just works for what I need, and the same goes for gnome (with a tonne of extensions and mods added, of course).
## Proper Dock
### Cycle Windows on Dock Click
```
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'cycle-windows'
```

View file

@ -1,134 +0,0 @@
# Hibernation
A few things I've discovered for hibernation, mainly in Ubuntu 20.04/10+(?).
## Enable hibernation, swap to disk (not partition)
Here is what I did to make it work with Ubuntu 18.04.
- Make your `/swapfile` have at least the size of your RAM
```
sudo swapoff /swapfile
sudo dd if=/dev/zero of=/swapfile bs=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}') count=1024 conv=notrunc
sudo mkswap /swapfile
sudo swapon /swapfile
```
- Note the UUID of the partition containing your `/swapfile`:
```
$ sudo findmnt -no UUID -T /swapfile
20562a02-cfa6-42e0-bb9f-5e936ea763d0
```
- Reconfigure the package `uswsusp` in order to correctly use the swapfile:
```
sudo dpkg-reconfigure -pmedium uswsusp
# Answer "Yes" to continue without swap space
# Select "/dev/disk/by-uuid/20562a02-cfa6-42e0-bb9f-5e936ea763d0" replace the UUID with the result from the previous findmnt command
# Encrypt: "No"
```
- Edit the SystemD hibernate service using `sudo systemctl edit systemd-hibernate.service` and fill it with the following content:
```
[Service]
ExecStart=
ExecStartPre=-/bin/run-parts -v -a pre /lib/systemd/system-sleep
ExecStart=/usr/sbin/s2disk
ExecStartPost=-/bin/run-parts -v --reverse -a post /lib/systemd/system-sleep
```
- Note the resume offset of your `/swapfile`:
```
$ sudo swap-offset /swapfile
resume offset = 34818
```
- Configure Grub to resume from the swapfile by editing `/etc/default/grub` and modify the following line:
```
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=20562a02-cfa6-42e0-bb9f-5e936ea763d0 resume_offset=34818 quiet splash"
```
- Update Grub:
```
sudo update-grub
```
- Create the following `/etc/initramfs-tools/conf.d/resume`:
```
RESUME=UUID=20562a02-cfa6-42e0-bb9e-5e936ea763d0 resume_offset=34816
# Resume from /swapfile
```
- Update initramfs:
```
sudo update-initramfs -u -k all
```
Now you can hibernate with `sudo systemctl hibernate`.
One can also create those scripts:
```
sudo tee /usr/local/bin/gotosleep <<EOF
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
sleep 2
sudo /usr/sbin/s2both
EOF
sudo chmod +x /usr/local/bin/gotosleep
sudo tee /usr/local/bin/gotohibernation <<EOF
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
sleep 2
sudo systemctl hibernate
EOF
sudo chmod +x /usr/local/bin/gotohibernation
```
So you can sleep with `gotosleep` or hibernate with `gotohibernation`.
You must be able to execute `sudo s2both`, `sudo s2ram` and `sudo systemctl hibernate`without having to enter your password for the previous scripts to work.
You could do that for example by creating a `powerdev` group, add your current user to it, and configure the following sudoers config (edit it with `sudo visudo -f /etc/sudoers.d/powerdev`):
```
%powerdev ALL=NOPASSWD: /usr/sbin/s2both, /usr/sbin/s2ram, /bin/systemctl hibernate
```
Documentation used:
- [Cas' answer](https://askubuntu.com/a/892410/29219)
- [Debian "Hibernate without swap partition"](https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition)
- [Configuring Lubuntu 18.04 to enable hibernation using a swap file](https://fitzcarraldoblog.wordpress.com/2018/07/14/configuring-lubuntu-18-04-to-enable-hibernation-using-a-swap-file/)
- [So question "s2disk works, but hibernation from menu gets stuck afer login"](https://askubuntu.com/q/1035345/29219)
## Enable suspend then hibernate
This enables ubuntu/linux to suspend then after a set amount of time hibernaate
To start using this function (suspend-then-hibernate) you need to create a file ```/etc/systemd/sleep.conf``` with the next content:
```
[Sleep]
HibernateDelaySec=3600
```
Then you can test it by command:
```sudo systemctl suspend-then-hibernate```
you can edit ```HibernateDelaySec``` to reduce delay to hibernate.
If all works fine you can change Lid Close Action, to do it you need to edit the file ```/etc/systemd/logind.conf```
You need to find option ```HandleLidSwitch=```, uncomment it and change to ```HandleLidSwitch=suspend-then-hibernate```. Then you need to restart systemd-logind service (warning! you user session will be restarted) by the next command:
```sudo systemctl restart systemd-logind.service```
That's all! Now you can use this nice function. (via [StackOverflow](https://askubuntu.com/questions/12383/how-to-go-automatically-from-suspend-into-hibernate))

View file

@ -1,96 +0,0 @@
# LibreOffice Macros
## Date Inserter with Header
This will automatically add a custom date format (DD.MM.1YYYY [T::HH:MM:sss]) with the Header 1 style for quick and easy 'captain logs'. I use the H.E. ([Holocene calendar](https://en.wikipedia.org/wiki/Holocene_calendar)) time format that believes theat humanity started 12,000 years ago with the advent of agriculture. Also, because I am a major [Foundation](https://sandyuraz.com/articles/foundation-time/) by Isaac Asimov nerd.
```
REM ***** BASIC *****
sub Date
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertDateField", "", 0, Array())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:FieldDialog", "", 0, Array())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:FieldDialog", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(1) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Template"
args4(0).Value = "Heading 1"
args4(1).Name = "Family"
args4(1).Value = 2
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args4())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
end sub
sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Template"
args1(0).Value = "Heading 1"
args1(1).Name = "Family"
args1(1).Value = 2
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(5) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Type"
args2(0).Value = 0
args2(1).Name = "SubType"
args2(1).Value = 0
args2(2).Name = "Name"
args2(2).Value = ""
args2(3).Name = "Content"
args2(3).Value = "0"
args2(4).Name = "Format"
args2(4).Value = 10051
args2(5).Name = "Separator"
args2(5).Value = " "
dim sText as string
sText = Format( Now, "DD.MM.1YYYY [T::HH\:mm\:ss]")
dim textFormatat(0) as new com.sun.star.beans.PropertyValue
textFormatat(0).Name = "Text"
textFormatat(0).Value = sText+CHR$(9)
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, textFormatat())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
end sub
```

View file

@ -1,7 +0,0 @@
# OneDrive
Rclone for virtual file system storage (cloud storage shouldn't download until you want them, in most cases). This is a startup script to unmount fuser on login (in case it didn't unmount properly on logout, shudown, or unexpected power loss) and then it instantiates the mount protocol for the virtual file system (vfs) with proper cacheing via Rclone.
This solves the issue of "transport endpoint is not connected" as well due to the unmounting call.
```sh -c "fusermount -uz ~/OneDrive; rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive"```'

View file

@ -1,12 +0,0 @@
# Trackballs
A selection of scripts to enhance trackball configs
## All Tracksballs
On Linux (X Servers) you can easily change the sensitivty with the follow script, the first number is sensitivity and the second is the accceleration, the acceleration is how fast it will speed up to be.
By default, the pointer (the on-screen representation of the pointing device) goes "acceleration" times as fast when the device travels more than "threshold" "mickeys" (i.e., would-be pixels) in 10 ms, including a small transition range. This way, the pointing device can be used for precise alignment when it is moved slowly, yet it can be set to travel across the screen in a flick of the wrist when desired. One or both parameters for the m option can be omitted, but if only one is given, it will be interpreted as the acceleration. If no parameters or the flag 'default' is used, the system defaults will be set.
If the "threshold" parameter is provided and is 0, the "acceleration" parameter will be used in the exponent of a more natural and continuous formula, giving precise control for slow motion but big reach for fast motion, and a progressive transition for motions between. Recommended "acceleration" value in this case is 3/2 to 3, but not limited to that range.
```xset m 5 10```

View file

@ -1,15 +0,0 @@
# Ubuntu
## Batch import all missing GPG keys
Solves issues with GPG keys on major OS updates by grabbing and replacing **all** missing creds from the keyserver.
There's no need to change any part of the command, just run it as is.
The command runs `sudo apt update` to update your software sources and detect missing GPG keys, then imports each missing key using [hkp://pool.sks-keyservers.net:80](https://sks-keyservers.net/) as its server, you could change this to any keyserver you feel most comfortable with ([http://keyserver.ubuntu.com](keyserver.ubuntu.com) is a possibility, but I've always had issues with it).
The command also uses an array to store missing GPG keys for which we've already imported the key. Without that, the key import command would run twice for each missing key.
```bash
sudo apt update 2>&1 1>/dev/null | sed -ne 's/.*NO_PUBKEY //p' | while read key; do if ! [[ ${keys[*]} =~ "$key" ]]; then sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys "$key"; keys+=("$key"); fi; done
```