A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.
Install the required build-tools (some might already be installed on your system).
#!/bin/bash | |
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \ | |
-H "Content-Type: application/x-www-form-urlencoded" \ | |
-d "username=admin" \ | |
-d 'password=admin' \ | |
-d 'grant_type=password' \ | |
-d 'client_id=admin-cli' | jq -r '.access_token') | |
curl -X GET 'http://localhost:8080/auth/admin/realms' \ |
// Bonfire: Mutations | |
// Author: @yurisbv | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations?solution=function%20mutation(arr)%20%7B%0A%20%20%0A%20%20var%20i%3D0%2Carr1%2Carr2%2Cletra%3B%0A%20%20%0A%20%20arr2%3D%20arr.pop().toLowerCase()%3B%0A%20%20arr2%3D%20arr2.split(%27%27)%3B%0A%20%20arr1%20%3D%20arr.pop(%27%27).toLowerCase()%3B%0A%20%20arr1%20%3D%20arr1.split(%27%27)%3B%0A%20%20%0A%20%20for(i%3Bi%3Carr2.length%3Bi%2B%2B)%7B%0A%20%20%20%20%2F%2Fletra%3Darr2.pop()%3B%0A%20%20%20%20if%20(arr1.indexOf(arr2%5Bi%5D)%3D%3D%3D-1)%0A%20%20%20%20%20%20return%20false%3B%0A%20%20%7D%0A%20%20%0A%20%20return%20true%3B%0A%7D%0A%0Amutation(%5B%22hello%22%2C%20%22yeh%22%5D)%3B%0A | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function mutation(arr) { | |
var i=0,arr1,arr2,letra; | |
arr2= arr.pop().toLowerCase(); |
// Bonfire: Truncate a string | |
// Author: @yurisbv | |
// 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%20%2F%2FSe%20o%20str.length%20%3E%20num%20return%20%22...%22%0A%20%20%2F%2FSe%20o%20str.length%20%3C%3D%203%20retornar%20num%2B...%0A%20%20%2F*%0A%20%20if(str.length%20%3E%20num)%7B%2F%2Fadicionar%20...%0A%20%20%20%20return%20str.slice(0%2Cnum-3).concat(%22...%22)%3B%0A%20%20%20%20%20%7D%20%0A%20%20else%20%0A%20%20%20%20%20if(str.lenght%20%3C%3D%203)%7B%0A%20%20%20%20%20%20%20return%20str.slice(0%2Cnum).concat(%22...%22)%3B%0A%20%20%20%20%20%7D%0A%20%20return%20str%3B%0A%7D%0A*%2F%0A%20%20if(num%20%3C%204)%7B%0A%20%20%20%20%20%20%20return%20str.slice(0%2Cnum).concat(%22...%22)%3B%0A%20%20%20%20%20%7D%0A%20%20else%0A%20%20%20%20if%20(str.length%20%3E%20num)%7B%2F%2Fadicionar%20...%0A%20%20%20%20return%20str.slice(0%2Cnum-3).concat(%22...%22)%3B%0A%20%20%20%20%20%7D%0A |