Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
eyes

Jason Brewer InBrewJ

🐼
eyes
View GitHub Profile
@InBrewJ
InBrewJ / FilterDependabotFromPRs.txt
Last active Jan 29, 2021
Filter for PRs from real people (i.e. not dependabot)
View FilterDependabotFromPRs.txt
is:open is:pr -author:app/dependabot
@InBrewJ
InBrewJ / rebase_from_master.sh
Created Oct 30, 2020
Rebasing from master - make your feature branch clean (All credit to @joeyciechanowicz)
View rebase_from_master.sh
git co -b feature-name
# ... do some stuff
git commit -am "message"
# .. go away for a while
git fetch origin/master
git rebase origin master
# ... do some more work
git add .
git commit --amend
@InBrewJ
InBrewJ / disable_network_interface.sh
Last active Sep 11, 2020
How to toggle a network interface in Pop OS 20.04 (on the wise ThinkPad)
View disable_network_interface.sh
# To show the current link state
ip link show
# To disable the wlp3s0 interface (the built in one)
if=wlp3s0
sudo ip link set $if down
# or
sudo ip link set wlp3s0 down
@InBrewJ
InBrewJ / highlight_depth.css
Last active Jul 30, 2020
All credit goes to this guy (Gajus Kuizinas): https://qr.ae/pNse0f
View highlight_depth.css
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
View jason_brewer_test_pairing_exercise.py
import unittest
import pairing_exercise
class TestPairingExercise(unittest.TestCase):
def test_calculate(self):
self.assertEqual(pairing_exercise.get_score('GUARDIAN1'), 10)
View jason_brewer_pairing_exercise.py
import random
from random import choices
name='Scrabble'
def split(word):
return [char for char in word]
score_map = {
"E": 1,
@InBrewJ
InBrewJ / Fibonacci.scala
Last active May 23, 2020
Iterative Fibonacci Sequence in Scala for no reason whatsoever
View Fibonacci.scala
object fibonnaci {
var lastMinusOne = 0
var last = 0
for (count <- 1 to 10) {
if (count == 2) lastMinusOne = lastMinusOne + 1
println({val current = last + lastMinusOne; current })
val tempLast = last
last = last + lastMinusOne // aka current
lastMinusOne = tempLast
@InBrewJ
InBrewJ / squash-the-squashed.sh
Created Mar 16, 2020
How to convert a PR with already squashed commits into a single commit
View squash-the-squashed.sh
# WARNING: THIS WILL GET RID OF THE COMMITS ON YOUR FEATURE BRANCH TOO!
# Original steps
# 1. Start with a clean version branch.
# 2. git reset master
# 3. git add . (notice trailing dot in there)
# 4. git commit -m "A really meaningful commit message"
# 5. git push --force
git reset master && \
@InBrewJ
InBrewJ / big_boy_branch.py
Last active May 23, 2020
Largest Branch: BST, Iteration!
View big_boy_branch.py
def goLeft(tree):
left_sum = 0
power_count = 1
descending = True
while descending:
for i in range( (2**power_count)-1, (2**(power_count+1))-1 ):
level_span = ((2**power_count)-1)
range_len = len(range( (2**power_count)-1, (2**(power_count+1))-1))
try: