mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 05:08:36 -06:00
Intial scripts upload
This commit is contained in:
parent
563c2f59a1
commit
3330dbda8f
14 changed files with 139 additions and 1 deletions
|
@ -1,2 +1,3 @@
|
|||
# Random Scripts
|
||||
This repository is for random scripts I wrote mostly for personal use. If anyone else finds these useful, they're most welcome.
|
||||
This repository is for random scripts I wrote mostly for personal use.
|
||||
Although this is mostly for archival purposes, if anyone else finds these useful, they're most welcome.
|
||||
|
|
10
bluetooth-toogle
Executable file
10
bluetooth-toogle
Executable file
|
@ -0,0 +1,10 @@
|
|||
# Toggles bluetooth on a Linux system. Make sure that you have bluetoothctl installed.
|
||||
# I use it with a shortcut.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(bluetoothctl show "A0:AF:BD:4F:D8:63" | grep Powered | grep -c yes) -eq 1 ]; then
|
||||
bluetoothctl power off
|
||||
else
|
||||
bluetoothctl power on
|
||||
fi
|
10
facebook-switch-to-desktop.user.js
Normal file
10
facebook-switch-to-desktop.user.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
// ==UserScript==
|
||||
// @name Facebook Switch to Desktop
|
||||
// @namespace Facebook
|
||||
// @match *://m.facebook.com/*
|
||||
// @grant none
|
||||
// @version 1.2
|
||||
// @author SinTan
|
||||
// @description 6/21/2020, 10:24:02 PM
|
||||
// ==/UserScript==
|
||||
window.location.href = window.location.href.replace("://m.", "://www.")
|
10
firefox-local-auto-redirection-fix.user.js
Normal file
10
firefox-local-auto-redirection-fix.user.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
// ==UserScript==
|
||||
// @name Firefox local auto-redirection fix
|
||||
// @namespace Local
|
||||
// @description A script for fixing the auto-redirection defined in local files in firefox
|
||||
// @match file:///*
|
||||
// @grant none
|
||||
// @author SinTan
|
||||
// @version 1.1
|
||||
// ==/UserScript==
|
||||
window.location.href=document.getElementsByTagName("a")[0].href
|
7
latex-cleanup
Executable file
7
latex-cleanup
Executable file
|
@ -0,0 +1,7 @@
|
|||
# I use it to clean up latex build files from a directory after I'm done with the project.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
[ 0 -lt $(ls *.tex 2>/dev/null | wc -w) ] && find . -maxdepth 1 -type f -regex ".*\.\(aux\|log\|synctex.gz\|bbl\|blg\)" -exec totrash {} \;
|
||||
echo "Done!"
|
||||
|
9
makebk
Executable file
9
makebk
Executable file
|
@ -0,0 +1,9 @@
|
|||
# This simply makes a backup of a file as filename.bak
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n "$1" ]];
|
||||
then
|
||||
cp "$1"{,.bak}
|
||||
fi
|
||||
|
19
manjaro-forum-auto-redirect.user.js
Normal file
19
manjaro-forum-auto-redirect.user.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// ==UserScript==
|
||||
// @name Manjaro Forum auto-redirect to old site for missing pages
|
||||
// @namespace Manjaro Linux Forum
|
||||
// @match https://forum.manjaro.org/t/*
|
||||
// @grant none
|
||||
// @version 1.1
|
||||
// @author SinTan
|
||||
// @description 9/4/2020, 1:36:13 PM
|
||||
// ==/UserScript==
|
||||
not_found = document.getElementsByClassName("page-not-found")
|
||||
if (not_found) {
|
||||
error_msg = not_found[0].getElementsByClassName("title")[0].innerHTML
|
||||
if (error_msg == "Oops! That page doesn’t exist or is private.") {
|
||||
redir_notif = document.createElement("h3")
|
||||
redir_notif.innerHTML = "(Redirecting to old forum...)"
|
||||
not_found[0].appendChild(redir_notif)
|
||||
window.location.href = window.location.href.replace("://forum.", "://archived.forum.")
|
||||
}
|
||||
}
|
7
start-font-fix.sh
Executable file
7
start-font-fix.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
# This was to fix an issue I was having where my terminal fonts were all over the place and tlp was autosuspending usb ports at startup.
|
||||
# Anyone else probably won't need it.
|
||||
|
||||
#! /bin/sh
|
||||
|
||||
source ~/.profile
|
||||
sudo ~/.local/bin/personal/usb-autosuspend-fix
|
6
totrash
Executable file
6
totrash
Executable file
|
@ -0,0 +1,6 @@
|
|||
# It simply moves files to trash:/ in KDE
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Move files to trash:/
|
||||
kioclient5 move "$@" trash:/
|
5
touch2
Executable file
5
touch2
Executable file
|
@ -0,0 +1,5 @@
|
|||
# It makes the parent folders (if needed) while touch-ing.
|
||||
|
||||
#!/bin/bash
|
||||
mkdir -p "$(dirname "$1")" &&
|
||||
touch "$1"
|
31
turbo-boost
Executable file
31
turbo-boost
Executable file
|
@ -0,0 +1,31 @@
|
|||
# This is to toggle intel turbo boost.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z $(which rdmsr) ]]; then
|
||||
echo "msr-tools is not installed. Run 'sudo apt-get install msr-tools' to install it." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z $1 && $1 != "enable" && $1 != "disable" ]]; then
|
||||
echo "Invalid argument: $1" >&2
|
||||
echo ""
|
||||
echo "Usage: $(basename $0) [disable|enable]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cores=$(cat /proc/cpuinfo | grep processor | awk '{print $3}')
|
||||
for core in $cores; do
|
||||
if [[ $1 == "disable" ]]; then
|
||||
sudo wrmsr -p${core} 0x1a0 0x4000850089
|
||||
fi
|
||||
if [[ $1 == "enable" ]]; then
|
||||
sudo wrmsr -p${core} 0x1a0 0x850089
|
||||
fi
|
||||
state=$(sudo rdmsr -p${core} 0x1a0 -f 38:38)
|
||||
if [[ $state -eq 1 ]]; then
|
||||
echo "core ${core}: disabled"
|
||||
else
|
||||
echo "core ${core}: enabled"
|
||||
fi
|
||||
done
|
6
turbo-boost-startup
Executable file
6
turbo-boost-startup
Executable file
|
@ -0,0 +1,6 @@
|
|||
# This simply triggers the turbo-boost script at startup.
|
||||
# I use it as a startup script.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
~/.local/bin/turbo-boost disable
|
7
usb-autosuspend-fix
Executable file
7
usb-autosuspend-fix
Executable file
|
@ -0,0 +1,7 @@
|
|||
# This was to fix an issue where tlp was autosuspending usb ports at startup.
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
echo 'on' > '/sys/bus/usb/devices/1-1/power/control'
|
||||
echo 'on' > '/sys/bus/usb/devices/1-2/power/control'
|
||||
echo 'on' > '/sys/bus/usb/devices/1-3/power/control'
|
10
wifi-toggle
Executable file
10
wifi-toggle
Executable file
|
@ -0,0 +1,10 @@
|
|||
# Toggles WiFi on a Linux system. Make sure that you have nmcli installed.
|
||||
# I use it with a shortcut.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
if [ $(nmcli r wifi | grep -c enabled) -eq 1 ]; then
|
||||
nmcli r wifi off
|
||||
else
|
||||
nmcli r wifi on
|
||||
fi
|
Loading…
Reference in a new issue