Skip to content

Instantly share code, notes, and snippets.

View colmarius's full-sized avatar
💭
🎶 🎹

Marius Colacioiu colmarius

💭
🎶 🎹
View GitHub Profile
@colmarius
colmarius / Setup-Dokku-on-Linode-Ubuntu-13.04
Last active September 8, 2015 04:26
Setup Dokku on Linode Ubuntu 13.04
# After building a new Linode Ubuntu 13.04 image...
ssh root@linode-123
# ...
uname -a
# Linux li348-235 3.12.9-x86_64-linode37 #1 SMP Mon Feb 3 10:01:02 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
apt-get update
apt-get install -y linux-virtual grub-legacy-ec2
@colmarius
colmarius / script_mongodump_mongorestore.sh
Last active March 1, 2018 18:42
Mongodump / Mongorestore example
##
## Prefer mongodump/mongorestore instead of mongoexport/mongoimport,
## as it will "export" additional metadata, like indexes etc.
##
### Mongodump example
# Required: host, db, collection, out
# Optional: query (limit results)
mongodump --host mongodb1.example.net \
@colmarius
colmarius / tmux-tmuxinator-setup.md
Last active May 16, 2024 02:27
Project start/stop with tmux + tmuxinator

1. Install tmux + tmuxinator

gem install tmuxinator

2. Add ~/.tmuxinator project specific configurations

# File: ~/.tmuxinator/project-name.yml

name: project-name
@colmarius
colmarius / git-aliases.md
Created September 23, 2014 09:50
A list of useful git aliases

Intro

Bellow follows a list of aliases, split between beginner and advanced.

To start using them right away you should place the aliases you like most in a file like ~/.zsh/git. Now all that remains is to add the following line to your ~/.zshrc or ~/.bashrc:

. ~/.zsh/git # git aliases
@colmarius
colmarius / stack_kata_steps.txt
Created March 5, 2015 12:42
Stack kata steps
# newly created stacks should be empty
# after one push stack size should be one
# after one push and one pop should be empty
# when pushed past limit stack overflows
# when empty stack popped should throw underflow
# when one is pushed one is popped
# when one and two are pushed two and one are popped
# when creating stack with negative size should throw illegal capacity
# when creating stack with zero capacity any push should overflow
# when one is pushed one is on top
@colmarius
colmarius / test_rotr.rb
Last active August 29, 2015 14:24
Solve rotr for hidden string
#!/usr/bin/env ruby
# Solved from https://docs.google.com/forms/d/1h6LtvCS3tVosk1-dbEsX54DsLxE6Xg9tTWUT2C-JqMk/viewform
hidden_string = 'bddpvout ejggfsfou gps qbttxpse b sfvtf opu Ep'
def rotr_word(word, number)
letters = word.split('')
.map do |letter|
(letter.ord + number).chr
@colmarius
colmarius / keybase.md
Created April 5, 2016 11:27
keybase.md

Keybase proof

I hereby claim:

  • I am colmarius on github.
  • I am colmarius (https://keybase.io/colmarius) on keybase.
  • I have a public key whose fingerprint is F2A6 4700 5AB9 3F22 8E30 9F3D 1701 A84E 226C 57CF

To claim this, I am signing this object:

@colmarius
colmarius / Ephemeral.rb
Last active May 20, 2016 21:42
Playing with ephemeral gem
#
# Playing with ephemeral gem
#
# - https://github.com/CoralineAda/ephemeral/
class Base
include Ephemeral::Base
def initialize(args={}); args.each{|k,v| self.send("#{k}=", v)}; end
end
@colmarius
colmarius / PostgreSQL_Upgrade.md
Last active July 8, 2016 05:49
PostgreSQL Upgrade

Inspired by this tip

Example of upgrading PostgreSQL from 9.3 to latest 9.5

Stop running application and services

Create a database backup

Stop any running postgres instance

@colmarius
colmarius / redux-connect-todo-app-refactor.js
Last active January 19, 2017 10:45
Redux egghead.io course: refactor with connect to create containers which use presentational components
const todo = (state, action) => {
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if (state.id !== action.id) {