Skip to content

Instantly share code, notes, and snippets.

View patrikjohansson's full-sized avatar

Patrik Johansson patrikjohansson

  • Gothenburg, Sweden
View GitHub Profile
@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active April 25, 2024 12:11
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@thenoseman
thenoseman / ruby_magic_comment.vim
Created December 28, 2011 13:21
Automatically adds the utf-8 magic comment to ruby files
" Adds the ruby magic comment to file
" Ignores SheBang-ed files
fun! AddMagicEncodingComment()
let line = getline(1)
let pos = getpos(".")
exec "normal gg"
if(match(line,"#!")) > -1
let line = getline(2)
exec "normal j"
endif