Skip to content

Instantly share code, notes, and snippets.

@smac89
smac89 / fbootfix.md
Last active Jun 19, 2021
Linux Fix Fastboot "no permissions, verify udev rules"
View fbootfix.md

Determine your device id

  1. Unplug your device from the computer and type lsusb in the terminal. You should get an output similar to this:
Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
@smac89
smac89 / instructions.md
Created May 28, 2021 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu
View instructions.md

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

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

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

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 / upgrade_packages.md
Last active May 14, 2021
Updating all packages installed by various package managers (brew, sdkman, gem, pip, etc)
View upgrade_packages.md

Brew

brew update && brew upgrade $(brew outdated)

SDKMAN

sdk selfupdate && sdk upgrade <package>

Gem

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

Pip

@smac89
smac89 / immutable-stack.scala
Last active May 4, 2021 — forked from lambda-hacker/immutable-stack.scala
Stack using List [Scala]
View immutable-stack.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 / egcd.py
Last active Feb 18, 2021
Extended Euclidean Algorithm in Python (Without recurrsion)
View egcd.py
#!/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 / Restoring Sanity.md
Last active Feb 11, 2021
Linux Desktop User: Sane defaults
View Restoring Sanity.md

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 / ObservableStack.java
Last active Jan 24, 2021
A simple implementation of a JavaFX observable stack
View ObservableStack.java
/**
* 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: