Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Luciano Ramalho ramalho

🏠
Working from home
Block or report user

Report or block ramalho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ramalho
ramalho / elide.py
Created Jul 24, 2019
elide: cut text at or before max_len, keeping complete words if possible
View elide.py
#!/usr/bin/env python3
def elide(text, max_len, ellipsis=''):
if len(text) <= max_len:
return text
cut = max_len
while cut > 0 and text[cut - 1].isalnum():
cut -= 1
@ramalho
ramalho / parameterized_test.exs
Created May 14, 2019 — forked from damonkelley/parameterized_test.exs
Parameterized Tests in Elixir
View parameterized_test.exs
defmodule ParamerizedTest do
use ExUnit.Case
@parameters [
{0, 0},
{1, 1},
{2, 4},
{3, 9},
]
@ramalho
ramalho / faixa_limitada.py
Created Mar 6, 2019
Resposta entre dois valores
View faixa_limitada.py
resposta = -1
while resposta < 0 or resposta > 150:
try:
resposta = int(input('Digite um valor entre 0 e 150: '))
except ValueError:
continue
@ramalho
ramalho / vizinhos.sh
Created Mar 4, 2019
Network neighborhood
View vizinhos.sh
#!/bin/bash
nmap -sn 192.168.15.0/24 | grep report | cut -d " " -f 5,6
@ramalho
ramalho / net-promoter-score.ipynb
Last active May 22, 2018
Net Promoter Score® Calculation
View net-promoter-score.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ramalho
ramalho / sinais.py
Created May 19, 2018
Arquivos do Coding Dojo com pytest na Lendico (2018-05-18)
View sinais.py
#!/usr/bin/env python3
import sys
def search(query, data):
query = query.replace('-',' ')
words = set(query.upper().split())
for code, char, name in data:
name = name.replace('-',' ')
if words <= set(name.split()):
View Principles-of-Adult-Behavior.md

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@ramalho
ramalho / go-missing-examples.md
Created Jan 14, 2018 — forked from andrestc/go-missing-examples.md
Go std lib funcs/methods missing examples
View go-missing-examples.md

About this

This list has the goal of helping developers interested in contributing to the Go language but are unsure of where to start. This was not generated manually so some functions and methods here may not require examples (maybe because they are too simple, e.g .String()) and some of these may only make sense in a package level example (which are not considered for this list yet). Use your best judgment and check the documentation before you open up a CL to add an example.

I will try to keep this list as up to date as possible. If you find any mistakes, please comment below and I will try to fix it. I plan on release the code I used to generate this in the future, so other go projects can benefit from it.

@ramalho
ramalho / pmp2jpeg.py
Created Nov 12, 2017
Utility to "convert" Sony PMP photo files to JPEG
View pmp2jpeg.py
#!/usr/bin/env python3
"""Extract JPEG files from Sony PMP files"""
import sys
import os
for name in sys.argv[1:]:
print(name, end='->')
with open(name, 'rb') as fp:
@ramalho
ramalho / flag-2
Created Oct 22, 2017
Bandeira do Brasil
View flag-2
stroke 0
# Start by drawing a green background.
background "#009b3a"
# We'll draw the yellow diamond as two triangles: a top, and a bottom.
color "#fedf00"
move -200
polygon 0, 0, 200, -130, 400, 0 # Top Half
You can’t perform that action at this time.