Skip to content

Instantly share code, notes, and snippets.

View mmstick's full-sized avatar
🦀
Developing Rust projects for Pop!_OS

Michael Murphy mmstick

🦀
Developing Rust projects for Pop!_OS
View GitHub Profile
@mmstick
mmstick / Ubuntu Fresh Install Script
Last active February 16, 2023 21:23
After installing Ubuntu, simply run this script to configure a fresh installation.
#!/bin/bash
# Ubuntu 13.10 and 14.04 should work perfectly with this script.
# PPAS
## Essentials
sudo add-apt-repository -y "deb http://archive.canonical.com $(lsb_release -sc) partner"
sudo add-apt-repository -y ppa:mc3man/mpv-tests # MPV (ffmpeg version)
sudo add-apt-repository -y ppa:atareao/nautilus-extensions # Nautilus Image Extensions
sudo add-apt-repository -y ppa:ubuntu-wine/ppa # Updated Wine Packages from Wine Developers
sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager # Namely for YAD
@mmstick
mmstick / Ubuntu Kernel Upgrader Script
Last active March 11, 2023 04:53
Asks the user whether they want to install the latest RC or stable, then downloads the correct kernel and installs it.
#!/bin/bash
cd /tmp
if ! which lynx > /dev/null; then sudo apt-get install lynx -y; fi
if [ "$(getconf LONG_BIT)" == "64" ]; then arch=amd64; else arch=i386; fi
function download() {
wget $(lynx -dump -listonly -dont-wrap-pre $kernelURL | grep "$1" | grep "$2" | grep "$arch" | cut -d ' ' -f 4)
}
@mmstick
mmstick / PulseAudio Configurator
Created January 19, 2014 13:53
Append -gui as an argument to use the GUI. This allows users to modify their local PulseAudio configuration simply and efficiently.
#!/bin/bash
# This script requires YAD to be installed
# Input New Values
if [ "$1" == "-gui" ]; then
## YAD Input Form
YADInput=$(yad --form \
--title="PulseAudio Configurator" \
--separator="," \
--field="Sample Rate:CB" "22050\!44100\!48000\!96000" \
--field="Sample Format:CB" "s16ne\!s24ne\!s32ne\!float32ne" \
#!/bin/bash
if [ "$1" == "" ]; then
printf "Enter Season Name: "; read season
else
season="$1"
fi
if [ "$2" == "" ]; then
printf "Enter Season ID : "; read id
else
@mmstick
mmstick / Random Bash Functions
Last active August 9, 2022 13:41
Simply a collection of bash functions/scripts that I don't particularly have a practical use for, but decided to make them since I was bored anyway. Feel free to put them in your bash_aliases file.
#!/bin/bash
function package-version {
apt-cache policy $1 | grep Installed | awk -F ' ' '{print $2}'
}
function kernel-current-version {
major=$(uname -r | awk -F '.' '{print $1}')
minor=$(uname -r | awk -F '.' '{print $2}')
if [ $(uname -r | grep rc) ]; then
rc="rc$(uname -r | awk -F '-' '{print $2}' | awk -F 'rc' '{print $2}')"
@mmstick
mmstick / printcolumns.cpp
Last active August 29, 2015 14:03
An example of how to print in columns from top to bottom in C++.
#include <iostream>
#include <string>
using namespace std;
int main() {
// Initial variables for the list
int listSize = 26;
int numOfColumns = 6;
string list[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
@mmstick
mmstick / factor.rs
Last active August 29, 2015 14:05
Experimenting with programming in Rust -- My first Rust program.
use std::os::{args};
use std::io::{stdin};
use std::u64::{parse_bytes};
// Convert the input string into a number if possible
fn str_to_number(input: &str) -> u64
{
match parse_bytes(input.as_bytes(), 10) {
Some(x) => x,
None => 0u64
package main
import "fmt"
import "os/exec"
import "time"
func errorChecker(output *[]byte, err *error, entry *string, elapsedTime time.Duration) {
if *err != nil {
fmt.Println(fmt.Sprint(*err) + ": " + string(*output))
} else {
@mmstick
mmstick / goencode.go
Last active November 23, 2017 00:12
Transcodes all episodes in the current directory and all of it's subdirectories into H.265 + Opus MKVs using ffmpeg. Make sure to have a copy of ffmpeg installed that can transcode to H.265 + Opus, preferably one that uses H.265 10-bit.
package main
import "flag"
import "fmt"
import "io/ioutil"
import "os"
import "os/exec"
import "time"
const (
@mmstick
mmstick / i3gostatusbar.go
Last active August 29, 2015 14:06
i3 status bar programmed in Go -- works with both laptops and desktops now. If a battery is present, it will print battery information. Otherwise, it will not print battery information. It will also automatically detect the currently active network connection and use statistics from that to notify the user how much data has been downloaded and u…
package main
import (
"fmt"
"io/ioutil"
"os"
"os/user"
"runtime"
"strconv"
"strings"