Skip to content

Instantly share code, notes, and snippets.

View crutchcorn's full-sized avatar
📒
Writing like whoa

Corbin Crutchley crutchcorn

📒
Writing like whoa
View GitHub Profile
@crutchcorn
crutchcorn / Awesome Windows Software.md
Last active April 20, 2017 17:08
Yes, I know it already exists. It also has nothing new on it
  • Foxit Reader
  • RenameIt!
  • Paint.Net
  • SmartGit
  • AIMP (with YouTube and Soundcloud plugins)
  • MediaMonkey
  • Typora
  • AquaSnap
  • PicPick
  • OBS
@crutchcorn
crutchcorn / Explaination.md
Created October 31, 2018 03:24
Dashpass Golf

c='children',l='reduce' - This creates two variables that I can reuse. Obviously, l is shorter than reduce, so I want to create aliases for the things we're gonna reuse. What these strings do will be explained later

r=e=> is creating a function called r that takes an argument e and returns what's after => (which I'm about to explain in a second)

e[c]&&e[c].length>0 - Remember that c = 'children'. We're checking that the argument supplied to function r (e) both has a property called children and that it contains more than 1 element in the list (the purpose of r (also called recurse https://gist.github.com/crutchcorn/e4a5f7e1d7c160d2a5d856ab66bfd657 for normal code version) is to be able to go down a tree of elements in a webpage and return a list of every child of any element)

[...e[c]] - We're taking the children of the argument and turning it into an array (previously, it was a list a lot LIKE an array, but it didn't have the reduce function we'll need to call in a second)

`

@crutchcorn
crutchcorn / scroll.js
Last active December 18, 2018 16:48
Ya ever want to scroll to the top of a page to take a screenshot on a 3rd party website? No? Oh. Okay.
a = setInterval(() => window.scrollTo(0, document.body.scrollHeight), 100);
clearInterval(a)
@crutchcorn
crutchcorn / anxiety-tips.md
Last active January 21, 2019 21:27
Anxiety Advice
  • Force deep and very slow breaths even if it feels a tiny bit like you can't breath (don't do so to the point where you're sufficating, but a minor discomfort is perfect normal (for me, since the intended effect is to be able to bypass your want to retract and panic) and okay. The intended effect is to slow the heart-rate which tricks your brain to calm down)
    • Inhale thru the nose, out the mouth.
    • Breath out through your mouth slowly, feel free to breath in more quickly but don't do that too fast either
  • Take slow movements
  • Sit up straight, don't lock up your shoulders (this reminds your brain that you're alright instead of instinctually locking up and reinforcing the anxiety)
  • Exhale super deeply until you can't exhale anymore, as if you were squeezing out all the oxygen from a bottle. This will allow your
@crutchcorn
crutchcorn / .bashrc
Last active February 1, 2019 18:21
WSL Setup File
# Switch to ZSH shell
if test -t 1; then
exec zsh
fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
ssh: {}
hotkeys:
shell: {}
new-tab:
- - Ctrl-T
- - Ctrl-Shift-T
next-tab:
- - Ctrl-Shift-ArrowRight
- - Ctrl-Tab
profile: {}

This is gonna seem like a fuckload of irrelevant CS shit but I swear it will all come together in the end Linux What is Linux? Technically speaking, a kernel CAN be built to only include an IPC (an IPC is what dictates what process to run in what order, and occationally [depending on the design] how memory is alliocated for that particular process).

Side note: A process is a single piece of running code. You can think of it like a thought. A single action (ala picking up something from the ground or deciding where to go to eat) CAN be one thought but is usually many processes that work together interlinked, but that's getting into userspace which I'll cover in a second But more often than not, a kernel includes a lot of other bits to understand what your hardware does (so basic backup graphics/x86 (x86 is a type of CPU that runs a specific set of instruction called x86) drivers, as well as stuff like file system drivers (so in linux one of the options is EXT3, but in Windows you get NTFS - this is HOW the 1s

const getPeeps = () => Promise.resolve([{name: 'Corbin', addr: 1}, {name: 'Nic', addr: 0}])
const getAddr = (val) => Promise.resolve(val ? 'My home' : 'Their home')
// Pure promise solution
getPeeps() 
.then(people => {
const peoplePromiseArr = people.map(person => {
return getAddr(person.addr).then(addr => {
person.addr = addr;
return person;

Given an array of integers 0-9 inclusive, compute the max sum of k elements in the array. Where the length of the array > 0 and k is 0 < k <= length array Example: array ar is ar = [3, 2, 4, 5, 1, 0, 9, 8, 8, 7], and k is k = 3. Should return 25. finish this function (this is python, but you can use any language):

def compute_max_k(ar, k):
    return

Optional Chaining

\b([.a-zA-Z]+)\s+?&&\s+?\1\.

This should find instances such as:

test && test.thing