Generate Puppet or Chef recipes from a Ubuntu system state
blueprint is DevStructure’s workhorse tool that looks inside popular package managers, finds changes you made to configuration files, and archives software you built from source to generate Puppet, Chef, or shell code. Everything blueprint sees is stored in Git to be diffed and pushed. It runs on Ubuntu Linux 10.04 and newer.
Related cards:
Generate a path or URL string from an array of route components
When using form_for
you can give the form's target URL either as a string or an array:
form_for(admin_user_path(@user)) do ... end
# same as:
form_for([:admin, @user]) do ... end
Same for link_to:
link_to("Label", edit_admin_u...
JavaScript: How to generate a regular expression from a string
Getting a regular expression from a string in JavaScript is quite simple:
new RegExp('Hello Universe');
# => /Hello Universe/
You can also use special characters:
new RegExp('^(\\d+) users')
# => /^(\d+) users/
Our expressi...
whenever: Installing cron jobs only for a given Rails environment or Capistrano stage
We use the whenever gem to automatically update the crontab of the servers we deploy to. By default, whenever will update all servers with a matching role ([we use the :cron
role ](https://makandracards.com/m...
Git: Retrieve a file from a different branch or commit
To access files from another branch or past commit without doing a complete checkout, you can either use
git show branch:file
git show commit:file
to display, or check out the file into your working directory with
git checkout bra...
Bookmarklet to generate a Pivotal Tracker story from Zammad Ticket
This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in Pivotal Tracker from a Zammad ticket. This might come in handy when creating stories for SWAT Teams.
But first you will have to set two variables in ...
How to get information about a gem (via CLI or at runtime from Ruby)
When you need information about a gem (like version(s) or install path(s)), you can use the gem
binary from the command line, or the Gem
API inside a ruby process at runtime.
gem
binary (in a terminal)
You can get some information abou...
Apache: Require username/password authentication except from a single IP, host or network
You configured authentication in your Apache configuration that requires username and password but you want a single IP address, host or network to allow access without entering credentials you can use the code below.
To allow a network you can u...
Line wrap text from a Ubuntu Linux terminal
You can use fold
:
fold -sw 60
You can now paste your texts. fold
will echo them back, word-wrapped after 60 columns. Exit with Ctrl+C
or Ctrl+D
.
You can also use files for input and output:
fold -sw 60 input.txt > output.txt
Generate a strong secret from the shell
A good tool to generate strong passwords and secrets is "apg". You can get it with
sudo apt-get install apg
To create a strong secret for sessions, [hashed Paperclip paths](https://makandracards.com/makandra/734-deliver-paperclip-attachments...
How to access a dmcrypt-encrypted partition from outside your system
This is for you when you want to mount a dmcrypt
encrypted partition manually, e.g. from a live CD.
First, open the dmcrypted partition (You need to provide some name. It may, but does not need to, be your LVM group name):
cryptsetup luksO...