Skip to content

Instantly share code, notes, and snippets.

View JoshCrosby's full-sized avatar

Josh Crosby JoshCrosby

View GitHub Profile
@JoshCrosby
JoshCrosby / The Technical Interview Cheat Sheet.md
Created October 18, 2017 12:56 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@JoshCrosby
JoshCrosby / accessing-virtualbox.md
Created December 29, 2017 18:21
Accessing your Virtualbox Guest from your Host OS

Accessing your Virtualbox Guest from your Host OS

As a developer you want to ping and access the webserver on your virtual machine. This is a very simple solution to enable the bridge to the guest VM.

Requirements

  • VirtualBox (latest version)
  • A guest operation system (e.g. Ubuntu)
@JoshCrosby
JoshCrosby / renamefiles.fish
Created January 3, 2018 02:34 — forked from staydecent/renamefiles.fish
File renaming pattern for Fish Shell with OSX sed
# 'Item*' it the pattern to look for
# sed "s/I/i/g" is the replacement pattern
for f in Item*; mv $f (echo {$f} | sed "s/I/i/g"); end
@JoshCrosby
JoshCrosby / spacemacs-cheshe.md
Last active January 24, 2018 23:27 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
bash_prompt_command() {
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
local NONE="\[\033[0m\]"

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@JoshCrosby
JoshCrosby / branch-fu.md
Created March 5, 2018 21:05 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@JoshCrosby
JoshCrosby / mysql-rename-db.sh
Created June 14, 2018 02:20 — forked from tadas-s/mysql-rename-db.sh
MySQL database rename script
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
@JoshCrosby
JoshCrosby / kubectl.md
Last active October 11, 2018 00:53 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@JoshCrosby
JoshCrosby / log_aws_lambda_event_and_context.py
Created October 9, 2019 22:33 — forked from gene1wood/log_aws_lambda_event_and_context.py
A python AWS Lambda function which logs the contents of the event and context variables passed into the function.
from __future__ import unicode_literals
import logging
import json
logger = logging.getLogger(__name__)
logging.getLogger().setLevel(logging.INFO)
class PythonObjectEncoder(json.JSONEncoder):
"""Custom JSON Encoder that allows encoding of un-serializable objects