Skip to content

Instantly share code, notes, and snippets.

View stevensdotb's full-sized avatar
:octocat:
Working from home

Richard Brito stevensdotb

:octocat:
Working from home
  • Spain
View GitHub Profile
@stevensdotb
stevensdotb / long_string_split.py
Last active November 10, 2023 11:27
Long String Split
def split_sring(*, string: str, max_chunk_length: int):
"""Split a string, preferible a long one into a list of chunks
parameters:
string -> String to be splited
max_chunk_length -> Chunks length
"""
chunks = []
from_char = 0
to_char = max_chunk_length
@stevensdotb
stevensdotb / cloudSettings
Last active December 29, 2020 09:20
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-29T09:20:40.891Z","extensionVersion":"v3.4.3"}

class has no 'objects' member

Install Django pylint: pip install pylint-djang

Go to: ctrl+shift+p > Preferences: Configure Language Specific Settings > Python

The settings.json available for python language should look like the below:

/**
* Avoid non-numeric characters on input text
*/
numberOnly(event) {
const value = event.target.value;
const lastChar = value.length > 0 ? Number(value[value.length - 1]) : 0 ;
const isNaN = char => char !== char;
if ( isNaN(lastChar) ) {
return false;
}
#!/usr/bin/env bash
###########################################
# Author: Stevens Brito
# Github: stevensdotb
# Email: stevensbrito.tech@gmail.com
###########################################
# Show usage help
function usage() {
#!/usr/bin/env bash
###########################################
# Author: Stevens Brito
# Github: stevensdotb
# Email: stevensbrito.tech@gmail.com
###########################################
# Set environment variables
export FLASK_CONFIG="development"
"""
Removes all files with a given extension
in the directory specified in the path.
Arguments in command line:
path: Path directory of the files
ext: The extension of the files
"""
@stevensdotb
stevensdotb / files_counter.py
Last active July 13, 2018 06:16
Files counter
"""
Counts all files with a given extension in the directory
specified in the path.
Arguments in command line:
path: Path directory of the files
ext: The extension of the files
"""
import os
@stevensdotb
stevensdotb / ipaddr_validator.py
Last active July 13, 2018 05:57
IP Address validator
import re
def validate(ip):
is_valid = True
split_ip = str(ip).split('.')
# 4 numbers separated by dots
if len(split_ip) == 4:
for number in split_ip: