You use lsblk and see your EBS volume is the right size, but running df -h shows the device is smaller. To fix this, the command to use is resize2fs
resize2fs /dev/xvdf
While you can do it on a mounted device, these things are often better done when it's unmounted, just to be safe.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ext4grow.html
Thursday, May 28, 2015
Monday, April 13, 2015
Fun with GPG
I once had a desire to create a team GPG key that I could use for signing RPMs. I've moved in a different direction, but I want to capture the steps in case I decide to use this again in the future.
You can import a private GPG with the following:
gpg --allow-secret-key-import --import private.key.file
gpg --list-keys
gpg --edit-key <ID>
Once you run --edit-key you're able to trust the key. Execute **trust** and choose level **5**
With that done, you can decrypt using the key - assuming you know the password.
gpg -d -u "name <email>" encrypted.file.gpg > outputfile
To encrypt for the team key to unlock:
gpg -se -r "name <email>" -u "name <email>" encrypted.file
Thursday, February 5, 2015
Port Forwarding on Mac OSX
If your running vagrant and you're forwarding traffic to vagrant over 8080, but you really prefer to hit port 80, you can use Mac's pfctl function.
Here's a couple of links that you might find helpful
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/pfctl.8.html
http://krypted.com/mac-os-x/a-cheat-sheet-for-using-pf-in-os-x-lion-and-up/
I was reading this article http://salvatore.garbesi.com/vagrant-port-forwarding-on-mac/ and it suggested adding a vagrant plugin, but it's a ruby gem. Hard to imagine, but the gem failed to install.
You can still implement port forwarding. Create a pfctl.conf file in your vagrant folder:
echo "rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 8080
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 8443" > pfctl.conf
To run this, you first need to enable pfctl
pfctl -e -f pfctl.conf
Once you enable the firewall rules, you can hit your vagrant box by going against localhost.
To disable pfctl:
pfctl -d
Here's a couple of links that you might find helpful
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/pfctl.8.html
http://krypted.com/mac-os-x/a-cheat-sheet-for-using-pf-in-os-x-lion-and-up/
I was reading this article http://salvatore.garbesi.com/vagrant-port-forwarding-on-mac/ and it suggested adding a vagrant plugin, but it's a ruby gem. Hard to imagine, but the gem failed to install.
You can still implement port forwarding. Create a pfctl.conf file in your vagrant folder:
echo "rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 8080
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 8443" > pfctl.conf
To run this, you first need to enable pfctl
pfctl -e -f pfctl.conf
Once you enable the firewall rules, you can hit your vagrant box by going against localhost.
To disable pfctl:
pfctl -d
Wednesday, January 21, 2015
Searching Log files with AWK
I was digging through my notes and came across this little nugget. Say you have a log file and that log file entry has URL encoded values that you would prefer to see decoded. Here's the AWK I used to URL decode:
awk -F ^C '$4 ~ /SearchingFor/ {print $4}' access_log | awk '
{
str = $0
while (match(str,/%/)) {
L = substr(str,1,RSTART-1) # chars to left of "%"
M = substr(str,RSTART+1,2) # 2 chars to right of "%"
R = substr(str,RSTART+3) # chars to right of "%xx"
str = sprintf("%s%c%s",L,hex2dec(M),R)
}
printf("%s\n",str)
}
function hex2dec(s, num) {
num = index("0123456789ABCDEF",toupper(substr(s,length(s)))) - 1
sub(/.$/,"",s)
return num + (length(s) ? 16*hex2dec(s) : 0)
}'
awk -F ^C '$4 ~ /SearchingFor/ {print $4}' access_log | awk '
{
str = $0
while (match(str,/%/)) {
L = substr(str,1,RSTART-1) # chars to left of "%"
M = substr(str,RSTART+1,2) # 2 chars to right of "%"
R = substr(str,RSTART+3) # chars to right of "%xx"
str = sprintf("%s%c%s",L,hex2dec(M),R)
}
printf("%s\n",str)
}
function hex2dec(s, num) {
num = index("0123456789ABCDEF",toupper(substr(s,length(s)))) - 1
sub(/.$/,"",s)
return num + (length(s) ? 16*hex2dec(s) : 0)
}'
I found this on the web and I post it here so I don't loose it. I would love to give credit if I could remember where I got it.
Monday, January 12, 2015
How to merge in specific files from one git branch to another
I found this write up very helpful:
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/
git checkout <branch> <file>
So, say you have a feature branch foo and your master branch and you want to get one file, src/bar.c into master
git checkout master
git checkout foo src/bar.c
git commit -m "merging bar.c from foo branch" src/bar.c
That's it.
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/
git checkout <branch> <file>
So, say you have a feature branch foo and your master branch and you want to get one file, src/bar.c into master
git checkout master
git checkout foo src/bar.c
git commit -m "merging bar.c from foo branch" src/bar.c
That's it.
Tuesday, November 11, 2014
Git: How to clone a repository using a token on the command line
I was creating a vagrant development instance and I wanted clone from our private repository and this was something I intended to share. So, I didn't want anyone to have to log in and I didn't want to have manual steps. Since we already had a token for our group, I wanted to be able to use the token to clone and do git pulls on the development instance for all of our puppet configs. I found a solution on the web that led to the answer.
Create your token: Read up on how to create a token and create your token on github - it's easy. I used this link: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
Then you can use your token to do anything it allows you. For example:
git clone --recursive https://TOKEN-GOES-HERE:x-oauth-basic@github.com/private-repo/puppet-configs.git /etc/puppet
The site that helped me was this one:
http://rzrsharp.net/2013/07/02/private-github-repos-with-npm-and-heroku.html
Create your token: Read up on how to create a token and create your token on github - it's easy. I used this link: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
Then you can use your token to do anything it allows you. For example:
git clone --recursive https://TOKEN-GOES-HERE:x-oauth-basic@github.com/private-repo/puppet-configs.git /etc/puppet
The site that helped me was this one:
http://rzrsharp.net/2013/07/02/private-github-repos-with-npm-and-heroku.html
Thursday, November 6, 2014
Git: How to delete a tag off the remote repo
If you have a tag named '12345' then you would just do this:
git tag -d 12345
git push origin :refs/tags/12345
That will remove '12345' from the remote repository.
Found that wonderful piece of help here:
http://nathanhoad.net/how-to-delete-a-remote-git-tag
Subscribe to:
Posts (Atom)