Skip to content

Instantly share code, notes, and snippets.

View smac89's full-sized avatar

Nobleman smac89

View GitHub Profile
@smac89
smac89 / fbootfix.md
Last active January 25, 2024 03:27
Linux Fix Fastboot "no permissions, verify udev rules"

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 November 17, 2023 06:12
Stream github webhook requests from smee.io on Linux
  1. Follow the instructions for creating a webhook
  2. Follow the instructions for forwarding the webhooks to your local environment
  3. Once you have smee running, use the following command to see the events as they arrive: ncat -lk 127.0.0.1 3000 | stdbuf -o0 grep -Eo '^\{.*\}' | jq --unbuffered
  4. Replace 127.0.0.1 and 3000 with the address of the server which smee is forwarding events to
@smac89
smac89 / install_ffmpeg.sh
Last active August 22, 2023 19:48
Install latest version of ffmpeg on Ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
# Create a dir where the rest of the sources will live
mkdir ~/ffmpeg_sources
@smac89
smac89 / zsh-lazy.md
Last active August 4, 2023 05:56
ZSH lazy loading #zsh #lazy

The following is a function I use in my .zshrc file to achieve some form of lazy evaluation.

local function lazy_load() {
    local -xr thunk="$(cat)"
    # (u) removes duplicates
    local -xr triggers=(${(u)@})
    
    # Only if length of triggers is greater than zero
 # otherwise the function will immediately execute.
@smac89
smac89 / post.md
Last active July 28, 2023 02:18
Xfce Lockscreen with xsecurelock and xscreensaver #linux #xfce
  • Install both xscreensaver and xsecurelock using your package manager

  • Make sure xscreensaver is not set to lock the screen or to manage the display. Xfce aleady does all those, so there is no need to enable it again.

  • Also make sure that the xscreensaver daemon is not autostarted. Not doing this may result in the screen not being locked.

  • Set the following environmental variables (in ~/.xprofile or ~/.xsession) for xsecurelock:

    # xsecurelock options
    

export XSECURELOCK_SAVER=saver_xscreensaver

@smac89
smac89 / ubuntu wireless adapter rtl8812au.md
Last active May 22, 2023 06:52
BrosTrend wireless card adapter (Linux installation) #wireless
@smac89
smac89 / Main.java
Last active January 24, 2023 21:32
Read a large json file, but do so lazily so as to not use too much memory. Thanks to Java 8 streams, this is quite possible
import com.google.common.io.Resources;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
@smac89
smac89 / journal.log
Last active July 16, 2021 05:13
KDE plasma crash on external monitor hotplug
-- Journal begins at Sat 2021-06-12 17:25:40 CST, ends at Thu 2021-07-15 23:05:02 CST. --
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: RRNotify_OutputChange
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Output: 677
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: CRTC: 0
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Mode: 0
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Rotation: "Rotate_0"
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Connection: "Connected"
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Subpixel Order: 0
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: RRScreenChangeNotify
Jul 15 23:03:06 ArcoB kscreen_backend_launcher[3064]: kscreen.xcb.helper: Window: 25165829
@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

@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