Skip to content

Instantly share code, notes, and snippets.

View smac89's full-sized avatar

Nobleman smac89

View GitHub Profile
@smac89
smac89 / post.md
Created September 1, 2020 19:41
XFCE Exo remove unused applications #exo #xfce #desktop

Clearing old applications from xfce exo

In order to find out where exo reads desktop applications from, I had to run the application from my terminal using the command:

strace exo-preferred-applications 2>&1 | grep 'openat.*\.desktop'

This allowed me to identify two folders where exo reads preferred applications from:

@smac89
smac89 / 1. Firefox Tips.md
Last active September 8, 2020 03:33
Tips for using firefox on Linux #firefox #linux #desktop #tuning
@smac89
smac89 / ObservableStack.java
Last active January 24, 2021 11:53
A simple implementation of a JavaFX observable stack
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Smac89
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@smac89
smac89 / Restoring Sanity.md
Last active February 11, 2021 05:09
Linux Desktop User: Sane defaults

Being a Linux desktop user is not easy, but it doesn't have to be difficult.

Enabling persistent journals

This is especially useful for collecting logs of system issues.
@smac89
smac89 / egcd.py
Last active February 18, 2021 08:48
Extended Euclidean Algorithm in Python (Without recurrsion)
#!/usr/bin/python3
import math
# Taken in part from: https://www.geeksforgeeks.org/python-program-for-basic-and-extended-euclidean-algorithms-2/
def gcdExtended(a, b):
"""
Calculates the GCD of the two given numbers, as well as the coefficients x and y
such that ax + by = gcd(a,b). This is useful in cryptography
See: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
@smac89
smac89 / immutable-stack.scala
Last active May 4, 2021 18:28 — forked from lambda-hacker/immutable-stack.scala
Stack using List [Scala]
// Immutable Stack Type using List
case class Stack[A] (elems: Seq[A] = List.empty[A]) {
def push(v: A) : Stack[A] = Stack(v +: elems)
def pushAll(xs: Iterable[A]) : Stack[A] =
xs.foldLeft (this) ((accStack, e) => accStack.push(e))
def pop(): Either[String, (A, Stack[A])] = {
if (isEmpty) Left("Cannot pop from empty stack")
@smac89
smac89 / upgrade_packages.md
Last active May 14, 2021 20:22
Updating all packages installed by various package managers (brew, sdkman, gem, pip, etc)

Brew

brew update && brew upgrade $(brew outdated)

SDKMAN

sdk selfupdate && sdk upgrade <package>

Gem

gem update $(gem list | cut -d' ' -f1)

Pip

@smac89
smac89 / sparse.md
Created May 16, 2021 05:30
Git sparse checkout a folder from specific branch

The goal

Checkout the llvm folder from the release/11.x branch in https://github.com/llvm/llvm-project

My process

git init llvm-project
cd llvm-project
git remote add origin https://github.com/llvm/llvm-project
git fetch --depth=1
git config core.sparseCheckout true
@smac89
smac89 / instructions.md
Created May 28, 2021 22:05 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache