Skip to content

Instantly share code, notes, and snippets.

View smac89's full-sized avatar

Nobleman smac89

View GitHub Profile
@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 / 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
@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 / 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 / 1. Firefox Tips.md
Last active September 8, 2020 03:33
Tips for using firefox on Linux #firefox #linux #desktop #tuning
@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 / jwt.mjs
Last active August 5, 2020 20:25
Learning how JWT works
import crypto from 'crypto';
import assert from 'assert';
const header = {"alg":"HS256","typ":"JWT"};
const payload = {"loggedInAs":"admin","iat":1422779638};
const unsignedToken = Buffer.from(JSON.stringify(header)).toString('base64') +
'.' + Buffer.from(JSON.stringify(payload)).toString('base64');
const hmac = crypto.createHmac('sha256', 'secretkey');