Skip to content

Instantly share code, notes, and snippets.

Gustavo RV 86 gustavorv86

Block or report user

Report or block gustavorv86

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
@gustavorv86
gustavorv86 / rest-time.py
Created Oct 3, 2019
Pythonic Rest time service using Flask
View rest-time.py
#!/usr/bin/env python3
import datetime
import time
## Install Flask library: pip3 install flask-restful
from flask import Flask
from flask_restful import Api, Resource, reqparse
## Tests:
@gustavorv86
gustavorv86 / colors.py
Created Oct 1, 2019
Print Bash palette color in python
View colors.py
#!/usr/bin/env python3
def colors_16():
print("\n\n8/16 COLORS\n")
buff = ""
for i in range(30, 38):
buff += "\t\033[{}m {}".format(i, i)
print(buff)
@gustavorv86
gustavorv86 / jpg_sort.py
Last active Sep 29, 2019
Renamed a lot of JPG files by the taken date
View jpg_sort.py
#!/usr/bin/env python3
"""
Author: gustavorv86
Usage: Copy this script into the folder with the JPG files and execute it.
"""
try:
import os
import shutil
import sys
@gustavorv86
gustavorv86 / sources.list
Created Aug 19, 2019
Debian Bullseye/Testing official repositories
View sources.list
#
# deb cdrom:[Debian GNU/Linux testing _Bullseye_ - Official Snapshot amd64 xfce-CD Binary-1 20190812-04:04]/ bullseye main
deb http://deb.debian.org/debian testing main contrib non-free
deb-src http://deb.debian.org/debian testing main contrib non-free
deb http://deb.debian.org/debian testing-updates main contrib non-free
deb-src http://deb.debian.org/debian testing-updates main contrib non-free
@gustavorv86
gustavorv86 / c_string_append.c
Last active Aug 13, 2019
String append function written in C
View c_string_append.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_BUF 128
int string_append(char * buffer, size_t buffer_size, const char * string) {
size_t buffer_len = strlen(buffer);
size_t free_size = buffer_size - buffer_len;
size_t string_len = strlen(string);
@gustavorv86
gustavorv86 / c_string_to_int.c
Last active Aug 13, 2019
Converts string to integer checking input errors.
View c_string_to_int.c
/**
* Compile:
* gcc -Wall -Wextra -ggdb c_string_to_int.c -o string_to_int
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
int string_to_int(const char * string, int * retval) {
@gustavorv86
gustavorv86 / c_string_trim.c
Last active Aug 13, 2019
Function to trimmed string in ANSI C 11
View c_string_trim.c
// COMPILE: gcc -std=c11 -Wall -Wextra c_string_trim.c -o string_trim
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
char * string_trim(char * string) {
int s_size = strlen(string);
@gustavorv86
gustavorv86 / pyConversor.py
Last active Oct 18, 2019
Graphical user interface (aka GUI) to convert from/to binary, decimal, hexadecimal and IP address using Tkinter python modules.
View pyConversor.py
#!/usr/bin/env python3
import ipaddress
import tkinter
import tkinter.ttk
import tkinter.messagebox
import sys
def bin2dec(value):
@gustavorv86
gustavorv86 / json_utils.py
Created May 22, 2019
Serialize and deserialize python dictionaries to JSON format.
View json_utils.py
import json
import sys
def serialize(json_data, json_filename):
try:
json_string = json.dumps(json_data, sort_keys=True, indent=4)
fd = open(json_filename, "w")
fd.write(json_string)
@gustavorv86
gustavorv86 / find_broken_symlinks.py
Created May 17, 2019
Search broken symbolic links into a directory.
View find_broken_symlinks.py
You can’t perform that action at this time.