Skip to content

Instantly share code, notes, and snippets.

View yurisbv's full-sized avatar

yuri Brandão yurisbv

View GitHub Profile
@dschep
dschep / raspbian-python3.6.rst
Last active October 24, 2023 14:57 — forked from BMeu/raspbian-python3.5.rst
Installing Python 3.6 on Raspbian

Installing Python 3.6 on Raspbian

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.

  1. Install the required build-tools (some might already be installed on your system).

@paoloantinori
paoloantinori / keycloak.sh
Created January 26, 2016 15:59
Keycloak Admin API Rest Example
#!/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
@sloria
sloria / bobp-python.md
Last active April 20, 2024 13:02
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens