Every so often you need to make sure a directory is created when you checkout a git repository. For example, if it's the output directory for a process like grunt/gulp. Because Git tracks files and not directories it doesn't make this easy but there is a way around.
Read More
Note to self:
if (typeof nameOfFunction == 'function') {
nameOfFunction();
}
I didn't feel like I had enough for a August version. Enjoy:
I don't know why Amazon has to make this so complicated but this is a good guide. I actually didn't even know they had some of these services.
I found this to be super helpful when finding a problem with a YAML document.
This is the best image I've seen to explain what DevOps is:
I'm going to adding this to some of my higher level input validation UnitTests ASAP.
This is the problem with free services. It's never free.
I find it interesting how some employees aren't happy with the working conditions at Amazon and some are. I don't have any solutions I just find it interesting.
There’s nothing wrong with basic exposure to computer science. But it should not come at the expense of fundamental skills such as reading, writing and mathematics — and unfortunately today our schools, with limited time, have tons of pressure on them to convey those basics better.
As someone who hires programmers I understand the need for them right now but I don't think everyone needs to know how to program. Spelling and grammar are WAY more important in my opinion.
via https://www.reddit.com/r/programmerhumor
Another cool project I wish I had time to look into.
I found this podcast to be scary. We have a lot of FLOSS software out there that's key to everything working correctly and it really sounds like the NTP project needs help.
One of the things I love about Vagrant is how it allows you to quickly create a VM that is very close to your production environment (or better yet EXACTLY like it). We’re starting to work on scaling STAGES from a single server to multiple servers so I’m using Vagrant as the test bed for this process. Because of this we need to work with multiple VMs in the same Vagrant file which isn’t covered by most tutorials.
Read MoreI'm amazed at what you do with all these TLDs now. I would love to know how this is setup because I'm guessing they don't have all these routes setup as individual servers.
$ traceroute bad.horse
traceroute to bad.horse (162.252.205.157), 64 hops max, 52 byte packets
<snip>
11 sandwichnet.dmarc.lga1.atlanticmetro.net (208.68.168.214) 49.889 ms 43.647 ms 56.112 ms
12 bad.horse (162.252.205.130) 45.896 ms 67.432 ms 63.962 ms
13 bad.horse (162.252.205.131) 833.709 ms 59.710 ms 54.396 ms
14 bad.horse (162.252.205.132) 814.477 ms 65.076 ms 72.313 ms
15 bad.horse (162.252.205.133) 845.153 ms 65.974 ms 71.903 ms
16 he.rides.across.the.nation (162.252.205.134) 1005.514 ms 76.433 ms 70.260 ms
17 the.thoroughbred.of.sin (162.252.205.135) 78.030 ms 84.778 ms 82.103 ms
18 he.got.the.application (162.252.205.136) 81.958 ms 91.702 ms 89.762 ms
19 that.you.just.sent.in (162.252.205.137) 78.926 ms 111.493 ms 121.994 ms
20 it.needs.evaluation (162.252.205.138) 1089.204 ms 119.346 ms 86.235 ms
21 * so.let.the.games.begin (162.252.205.139) 824.353 ms 109.227 ms
22 a.heinous.crime (162.252.205.140) 395.029 ms 109.385 ms 103.859 ms
23 a.show.of.force (162.252.205.141) 894.271 ms 101.942 ms 816.086 ms
24 a.murder.would.be.nice.of.course (162.252.205.142) 151.219 ms 120.066 ms 112.940 ms
25 bad.horse (162.252.205.143) 830.347 ms 126.804 ms *
26 bad.horse (162.252.205.144) 831.879 ms 124.121 ms 829.909 ms
27 bad.horse (162.252.205.145) 153.145 ms 121.823 ms 120.593 ms
28 he-s.bad (162.252.205.146) 794.691 ms 128.833 ms 963.309 ms
29 the.evil.league.of.evil (162.252.205.147) 874.891 ms 130.897 ms 996.284 ms
30 is.watching.so.beware (162.252.205.148) 1015.256 ms 138.584 ms 136.056 ms
31 the.grade.that.you.receive (162.252.205.149) 823.512 ms 140.524 ms 958.807 ms
32 will.be.your.last.we.swear (162.252.205.150) 985.993 ms 170.036 ms 1126.852 ms
33 so.make.the.bad.horse.gleeful (162.252.205.151) 764.192 ms 148.757 ms 875.543 ms
34 or.he-ll.make.you.his.mare (162.252.205.152) 154.182 ms 159.267 ms 157.833 ms
35 o_o (162.252.205.153) 987.712 ms 693.894 ms 260.516 ms
36 you-re.saddled.up (162.252.205.154) 170.334 ms 221.692 ms 907.964 ms
37 there-s.no.recourse (162.252.205.155) 169.672 ms 182.466 ms 900.873 ms
38 it-s.hi-ho.silver (162.252.205.156) 174.726 ms 187.102 ms 176.050 ms
39 signed.bad.horse (162.252.205.157) 773.483 ms 180.166 ms 789.419 ms
via https://www.reddit.com/r/ProgrammerHumor/comments/3mctr2/the_thoroughbred_of_sin/
Several months ago I deleted a functions because we didn't think we needed it any more. Today I found out I was wrong but I couldn't remember when I deleted it or I could just check the commit and pull the function back in. In order to find the commit where the code was deleted you can use the following command:
$ git log -SfunctionNameHere
commit 60b42b9d06dc8a046d338fddf99548f056c2305c
Author: Scott Keck-Warren <warren5236@gmail.com>
Date: Sun Mar 16 11:45:41 2014 -0400
Renamed String class to StringObject
Then to see the code that was changed you can use:
$git show 60b42b9d06dc8a046d338fddf99548f056c2305c
diff --git a/PHPO/String.php b/PHPO/String.php
deleted file mode 100644
index f87926b..0000000
--- a/PHPO/String.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-namespace PHPO;
-
-use PHPO\ArrayObject;
<snip>
I found this to be amazing so I thought I would share it.
If you're running a query that might cause data loss on the fly (maybe a delete or an update) you can wrap the query in a transaction to make sure you don't mess up data:
start transaction;
update table set thing=1 where 1=1;
-- Double check results here.
commit;
-- or
rollback;
Learned via reddit
We're using Zend_Ldap
to authenticate users using LDAP on a project. One of the clients we setup was having a problem getting the connection to work where our web server would connect to their LDAP server and then it would pause for 30 minutes before returning an error. To debug this you set the following option:
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
Then you would just call ldap_error
to get the debug information. We didn't want random bugs listed on our server but it turns out that with this set the debug settings are logged to the php.log.
I've talked about how you can dump only selected records using mysqldump. The other day I didn't have a specific parameter I was filtering on I just needed the first 1000 records from a table. To do this you can use the following "hack":
mysqldump -uroot -ppassword databaseName tableName --where='1 limit 1000'
I've been experimenting with Ansible for new server setup and I was amazed to see Vagrant supports it out of the box (I guess I shouldn't be Vagrant is a great piece of software). When I tried to use it on my Windows laptop I received the following error:
> vagrant up test
Bringing machine 'test' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix the following errors and try again:
ansible provisioner:
* `playbook` for the Ansible provisioner does not exist on the host system: C:/path/playbook.yml
I said to myself:
It's okay I'll just install ansible on Windows. How hard could it be?
It turns out it's not simple and I don't really want to have to do this on all our computers. I know it seems like a small amount of work but it adds up.
The fix for this was for me to run the playbook inside the VM. First I setup the Vagrantfile
to run a shell script:
config.vm.provision :shell, :inline =>
"/path/to/ansible/provision.sh"
Then inside the shell script we're going to install ansible (if the ansible-playbook executable doesn't exist) and then we're going to run the playbook.
if [ ! -f /usr/bin/ansible-playbook ]
then
apt-get install software-properties-common
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install -y ansible
fi
ansible-playbook --inventory="localhost," -c local /path/to/ansible/playbook.yml
By using the -c local
we're telling anisble to make a local connection and not use SSH because then we would need to setup keys and that seems like a lot of unnecessary work. :-)
subscribe via RSS