Skip to content

Instantly share code, notes, and snippets.

@exAspArk
exAspArk / The Technical Interview Cheat Sheet.md
Created January 20, 2016 11:11 — 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.
source 'https://rubygems.org'
gem 'puma'
gem 'sinatra'
gem 'faraday'
gem 'typhoeus'
group :development do
require "net/http"
require "socket"
socket = "/tmp/portal2.sock"
sock = Net::BufferedIO.new(UNIXSocket.new(socket))
request = Net::HTTP::Get.new("/")
request.exec(sock, "1.1", "/")
begin
(export LC_ALL="ru" ; awk '{split($0,l,";") ; print l[2],l[3],l[4]}' ~/.zsh_history | sort | uniq -c | sort -nr | head -n 20)
@exAspArk
exAspArk / memory_middleware.rb
Created December 27, 2016 16:12
MemoryMiddleware
class MemoryMiddleware
ENV_REQUEST_PATH = 'REQUEST_PATH'.freeze
ENV_PUMA_AFTER_REPLY = 'rack.after_reply'.freeze
LOGGER = Logger.new('/tmp/memory.log'.freeze)
def initialize(app)
@app = app
end
def call(env)
# Install https://www.vaultproject.io/
brew install vault
# Start dev vault server in a separate terminal
vault server -dev
# ==> Vault server configuration:
# ...
# Unseal Key: 7ACQHhLZY5ivzNzhMruX9kSa+VXCah3y87hl3dPSWFk=
# Root Token: 858a6658-682e-345a-e4c4-a6e14e6f7853
@exAspArk
exAspArk / ansible_vault_merge.sh
Last active March 4, 2021 22:21 — forked from benzado/vault-merge.sh
A shell script for merging encrypted Ansible vault files in a git repository
#!/bin/sh
###############################################################################
# USAGE:
# > ansible_vault_merge.sh [-p PASSWORD_FILE VAULT_YAML_FILE
# This shell script handles conflicts generated by attempts to merge encrypted
# Ansible Vault files. Run this command to attempt a merge on the unencrypted
# versions of the file. If there are conflicts, you will be given a chance to
@exAspArk
exAspArk / gpg-import-and-export-instructions.md
Last active October 14, 2023 03:04 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@exAspArk
exAspArk / web-servers.md
Created May 16, 2017 16:36 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@exAspArk
exAspArk / self-signed-ssl-mongo.sh
Last active May 25, 2024 18:36
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem