Skip to content

Instantly share code, notes, and snippets.

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

Stevens Brito stevensdotb

:octocat:
Working from home
  • Spain
View GitHub Profile
@stevensdotb
stevensdotb / linux_header_fixer.sh
Created September 17, 2024 23:15
Fix: Linux header error
# Check current dkms with `sudo dkms status`
sudo dkms uninstall <current_dkms>
sudo apt purge <current_dkms>
sudo apt remove dkms
sudo apt --fix-broken install
sudo apt autoremove
sudo apt update
sudo apt upgrade
@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

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;
}
"""
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