Skip to content

Instantly share code, notes, and snippets.

View andragabr's full-sized avatar

Andra andragabr

View GitHub Profile
30 April 2013
https://gist.github.com/anonymous/5491171
DevOps Days
@andragabr
andragabr / 01_intro.md
Created October 8, 2016 17:56 — forked from lost-theory/01_intro.md
Monitorama 2014 notes

Monitorama 2014 notes

http://monitorama.com/

Best talks day 1:

  • Please, no More Minutes, Milliseconds, Monoliths... or Monitoring Tools! - Adrian Cockcroft
    • gave 5 good rules for monitoring systems, showed what cloud / microservices monitoring looks like @ Netflix
  • Simple math to get some signal out of your noisy sea of data - Toufic Boubez
  • explains why static alert thresholds don't work and gave 3 techniques to use instead
@andragabr
andragabr / notes.md
Created October 8, 2016 17:56 — forked from lost-theory/notes.md
DevOps Master Class & Opbeat Launch, 2014-09-26
// Bonfire: Truncate a string
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-truncate-a-string?solution=function%20truncate(str%2C%20num)%20%7B%0A%20%20%2F%2F%20Clear%20out%20that%20junk%20in%20your%20trunk%0A%20%20if%20(num%20%3C%203)%0A%20%20%20%20return%20str.slice(0%2C%20num)%2B%22...%22%3B%0A%20%20%0A%20%20if(str.length%20%3E%20num)%7B%0A%20%20%20%20str%20%3D%20str.slice(0%2Cnum-3)%3B%0A%20%20%20%20str%20%2B%3D%20%22...%22%3B%0A%20%20%7D%0A%20%20return%20str%3B%0A%20%20%0A%7D%0A%0Atruncate(%22A-tisket%20a-tasket%20A%20green%20and%20yellow%20basket%22%2C%2011)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function truncate(str, num) {
// Clear out that junk in your trunk
if (num < 3)
return str.slice(0, num)+"...";
// Bonfire: Repeat a string repeat a string
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-repeat-a-string-repeat-a-string?solution=function%20repeat(str%2C%20num)%20%7B%0A%20%20%2F%2F%20repeat%20after%20me%0A%20%20if%20(num%20%3C%200)%0A%20%20%20%20return%20%22%22%3B%0A%20%20if%20(num%20%3E%200)%0A%20%20%20%20return%20str.repeat(num)%3B%0A%20%20%0A%7D%0A%0Arepeat(%22abc%22%2C%203)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function repeat(str, num) {
// repeat after me
if (num < 0)
return "";
if (num > 0)
// Bonfire: Confirm the Ending
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-confirm-the-ending?solution=function%20end(str%2C%20target)%20%7B%0A%20%20%2F%2F%20%22Never%20give%20up%20and%20good%20luck%20will%20find%20you.%22%0A%20%20%2F%2F%20--%20Falcor%0A%20var%20targetLen%20%3D%20target.length%3B%0A%20var%20endw%20%3D%20str.substr(-targetLen)%3B%0A%20if%20(endw%20%3D%3D%3D%20target)%0A%20%20%20return%20true%3B%0A%20%20else%0A%20%20%20%20return%20false%3B%0A%20%20%0A%0A%7D%0A%0Aend(%22Bastian%22%2C%20%22n%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function end(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
var targetLen = target.length;
var endw = str.substr(-targetLen);
// Bonfire: Return Largest Numbers in Arrays
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays?solution=function%20largestOfFour(arr)%20%7B%0A%20%20%2F%2F%20You%20can%20do%20this!%0A%0A%20%20var%20max%20%3D%20%5B0%2C%200%2C%200%2C%200%5D%3B%0A%20%20%0A%20%20%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20arr.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20for(var%20j%20%3D%200%3B%20j%20%3C%20arr%5Bi%5D.length%3B%20j%2B%2B)%7B%0A%20%20%20%20%20%20%20%20if(%20max%5Bi%5D%20%3C%20arr%5Bi%5D%5Bj%5D)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20max%5Bi%5D%20%3D%20arr%5Bi%5D%5Bj%5D%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%7D%0A%20%20%7D%0A%20%20%0A%20%20return%20max%3B%0A%20%20%0A%0A%7D%0A%0AlargestOfFour(%5B%5B4%2C%205%2C%201%2C%203%5D%2C%20%5B13%2C%2027%2C%2018%2C%2026%5D%2C%20%5B32%2C%2035%2C%2037%2C%2039%5D%2C%20%5B1000%2C%201001%2C%20857%2C%201%5D%5D)%3B%0A%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function largestOfFour(arr) {
// You c
// Bonfire: Title Case a Sentence
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence?solution=function%20titleCase(str)%20%7B%0A%20%20var%20long%20%3D%20str.toLowerCase().split(%27%20%27)%3B%0A%20%20var%20test%3B%0A%0A%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20long.length%3B%20i%2B%2B)%7B%0A%20%20%20%2F%2Flong%5Bi%5D%20%3D%20charCodeAt(0).toUpperCase()%3B%0A%20%20%20%20long%5Bi%5D%20%3D%20long%5Bi%5D.charAt(0).toUpperCase()%20%2B%20long%5Bi%5D.substring(1)%3B%0A%20%20%7D%0A%20%20return%20long.join(%27%20%27)%3B%20%0A%7D%0A%0AtitleCase(%22I%27m%20a%20little%20tea%20pot%22)%3B%0AtitleCase(%22sHoRt%20AnD%20sToUt%22)%3B%0AtitleCase(%22HERE%20IS%20MY%20HANDLE%20HERE%20IS%20MY%20SPOUT%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function titleCase(str) {
var long = str.toLowerCase().split(' ');
var test;
// Bonfire: Find the Longest Word in a String
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string?solution=function%20findLongestWord(str)%20%7B%0A%20%20var%20long%20%3D%20str.split(%27%20%27)%3B%0A%20%20var%20final%20%3D%200%3B%0A%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20long.length%3B%20i%2B%2B)%7B%0A%20%20%20%20if(final%20%3C%20long%5Bi%5D.length)%7B%0A%20%20%20%20%20%20final%20%3D%20long%5Bi%5D.length%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20return%20final%3B%20%0A%20%20%20%20%0A%20%0A%7D%0A%0AfindLongestWord(%22The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog%22)%3B%0AfindLongestWord(%22The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog%22)%3B%0AfindLongestWord(%22May%20the%20force%20be%20with%20you%22)%3B%0AfindLongestWord(%22Google%20do%20a%20barrel%20roll%22)%3B%0AfindLongestWord(%22What%20is%20the%20average%20airspeed%20velocity%20of%20an%20unladen%20swallow%22)%3B%0AfindLongestWord(%22What%20if%20we%20try%20a%
// Bonfire: Check for Palindromes
// Author: @andragabr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes?solution=function%20palindrome(str)%20%7B%0A%20%20%2F%2F%20Good%20luck!%0A%20%20%20var%20isPalindrome%20%3D%20str.toLowerCase().replace(%2F%5CW%7C_%2Fg%2C%20%27%27)%3B%0A%20%20%20var%20reversedStr%20%3D%20isPalindrome.split(%27%27).reverse().join(%27%27)%3B%0A%20%20%20%0A%20%20if(reversedStr%20%3D%3D%3D%20isPalindrome)%20%7B%0A%20%20%20%20return%20true%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20return%20false%3B%0A%20%20%7D%0A%20%20%0A%7D%0A%0A%0A%0Apalindrome(%22eye%22)%3B%0Apalindrome(%22race%20car%22)%3B%0Apalindrome(%22not%20a%20palindrome%22)%3B%0Apalindrome(%22A%20man%2C%20a%20plan%2C%20a%20canal.%20Panama%22)%3B%0Apalindrome(%22never%20odd%20or%20even%22)%3B%0Apalindrome(%22nope%22)%3B%0Apalindrome(%22almostomla%22)%3B%0Apalindrome(%22My%20age%20is%200%2C%200%20si%20ega%20ym.%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str