Skip to content

Instantly share code, notes, and snippets.

@exAspArk
exAspArk / vim-heroku.sh
Created August 3, 2020 13:30 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
View vim-heroku.sh
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@exAspArk
exAspArk / gist:7db2544ab08990f5709a48186be7edbf
Created August 2, 2017 14:29 — forked from jjb/gist:7389552
Ruby 2.1 memory configuration
View gist:7db2544ab08990f5709a48186be7edbf

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/trunk/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@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
View web-servers.md

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 / 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
View gpg-import-and-export-instructions.md

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 / 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
View ansible_vault_merge.sh
#!/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 / 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.
View The Technical Interview Cheat Sheet.md

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.
View bench_rails_memory_usage.rb
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@exAspArk
exAspArk / hacks.rb
Last active August 29, 2015 14:08 — forked from conf/monkey_patches.rb
Get rid of TZInfo::AmbiguousTime exception
View hacks.rb
# config/initializers/hacks.rb
Dir[Rails.root.join("lib/hacks/**/*.rb")].each { |file| require file }
View wait_steps.rb
require "timeout"
module WaitSteps
extend RSpec::Matchers::DSL
matcher :become_true do
match do |block|
begin
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = block.call
View README.md

Commands examples

If the namespace is not used then the commands will perform on top of the default database.

  bundle exec rake db:create
  bundle exec rake db:migrate 

By using the namespace we are going to use all the configuration for our alternate DB.