Skip to content

Instantly share code, notes, and snippets.

View Phate6660's full-sized avatar
💚
Stay negative.

Cpt.Howdy Phate6660

💚
Stay negative.
View GitHub Profile
@Phate6660
Phate6660 / test.rs
Created September 26, 2021 01:58
A WIP for incorporating testing into crusty, as well as an example echo check function
#[test]
fn echo_check() {
use crate::{ShellState, process_input};
let mut shell_state = ShellState::init();
let success = process_input(&mut shell_state, "echo test".to_string());
assert!(success, "echo test failed!");
}
@Phate6660
Phate6660 / lobsters-dark.css
Last active January 16, 2022 08:42
A dark userstyle for https://lobste.rs that aims to be simple and robust.
body, textarea, input, button {
font-size: 11px;
}
a {
color: green;
}
p>a {
color: green !important;
@Phate6660
Phate6660 / dice
Last active May 16, 2021 17:59
A dice roll script.
#!/usr/bin/env bash
## A dice roll script.
## Usage: dice amount
## Example: dice 5
## Explanation: It will roll 5 6-sided dice, add their results, and output the dice roll.
##
## Dependencies: bcalc (https://github.com/Phate6660/bcalc), shuf
amount="${1}"
n=0
@Phate6660
Phate6660 / musinf.sh
Last active May 8, 2021 17:55
A snippet to display music info from MPD or Spotify.
#!/bin/bash
if [ "$(playerctl -p spotify,mpd metadata -f "{{ playerName }}")" == "mpd" ]; then
dunstify "$(echo -e "$(playerctl -p spotify,mpd metadata -f "Player: {{ playerName }}\n\nTIT: {{ title }}\nALB: {{ album }}\nART: {{ artist }}")")" -I "/tmp/cover.png"
elif [ "$(playerctl -p spotify,mpd metadata -f "{{ playerName }}")" == "spotify" ]; then
id="$(basename "$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata | awk -F '"' 'BEGIN {RS=" entry"}; /"mpris:artUrl"/ {a = $4} END {print a}')")"
url="https://i.scdn.co/image/$id"
curl "$url" -o "/tmp/cover-spotify.jpg"
dunstify "$(echo -e "$(playerctl -p spotify,mpd metadata -f "Player: {{ playerName }}\n\nTIT: {{ title }}\nALB: {{ album }}\nART: {{ artist }}")")" -I "/tmp/cover-spotify.jpg"
else
dunstify "$(echo -e "$(playerctl -p spotify,mpd metadata -f "Player: {{ playerName }}\n\nTIT: {{ title }}\nALB: {{ album
@Phate6660
Phate6660 / userChrome.css
Created February 3, 2021 19:58
My current Firefox UI modifications via userChrome.css
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* Hide horizontal tabs at the top of the window */
#tabbrowser-tabs {
visibility: collapse !important;
}
/*Collapse in default state and add transition*/
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] {
overflow: hidden;
@Phate6660
Phate6660 / Firefox Configuration Guide.md
Last active July 19, 2021 17:14
FCG is a guide for changing various settings in Firefox to make it better for privacy, disabling annoying stuff, and security.

Firefox Configuration Guide (FCG)

FCG is a guide for changing various settings in Firefox to make it better for privacy, disabling annoying stuff, and security.

Note: anything shown as preference = value is something that needs to be changed in about:config.

Table of Contents

@Phate6660
Phate6660 / rust recommendations and alternatives.md
Last active September 1, 2023 16:49
My growing list of Rust programs to use.
@Phate6660
Phate6660 / es
Created May 11, 2020 19:13
Choose a script to edit via rofi, and edit with $EDITOR.
#!/bin/bash
## The idea is to create a dmenu prompt with fancy names (i.e nameOfDirectory/nameOfScriptWithoutExtension) and open them in emacs.
## TODO: Open submenu if more than one of the same file is found.
script_dir="$HOME/scripts" # Set to whatever dir you store your scripts in. I personally prefer $HOME/scripts.
editor="$EDITOR" # Set to whatever editor you prefer, if you don't already have $EDITOR set.
# Print names of scripts without extensions into rofi's dmenu mode, and save the selection to the choice variable.
choice="$(ls -1 "$script_dir" | sed 's/\.[^.]*$//' | rofi -dmenu -p "Select script to edit")"
@Phate6660
Phate6660 / lfs-version-check-enhanced
Last active January 26, 2022 15:15
Modified version check script for LFS to make output a bit easier to read. WIP.
#!/bin/bash
## Simple script to list version numbers of critical development tools
## Original by LFS team / contributor(s), modified by Phate6660.
## Startup
export LC_ALL=C
## Aliases
bash_version="$(bash --version | head -n1 | cut -d" " -f2-4)"
binutils_version="$(ld --version | head -n1 | cut -d" " -f3-)"
@Phate6660
Phate6660 / apk_dl
Last active December 1, 2019 20:38
Wire and Signal apk downloader, with optional verification.
#!/bin/bash
## Note: This script requires curl, awk, and optionally sha256sum.
## Most distros have these installed by default, but just in case, I decided to leave this comment here.
clear && echo -e "Please input the path in which you'd like to download the apk.\nInput \".\" if you want to download to your current path."
read -p "> " dir
cd "$dir" || echo "Could not enter the directory, are you sure it exists? Using current directory instead."
clear && echo -e "What would you like to do?\n\n1. Download Wire.\n2. Download Signal.\n"
read -p "> " ans
case $ans in
1)