Skip to content

Instantly share code, notes, and snippets.

View RDCH106's full-sized avatar
Partially offline. No time...

Rubén de Celis Hernández RDCH106

Partially offline. No time...
View GitHub Profile
@RDCH106
RDCH106 / ANSIColorFix.py
Created October 5, 2016 10:06
ANSI Colors Fix for Python in Windows
import os
import platform
if os.name == 'nt' and platform.release() == '10' and platform.version() >= '10.0.14393':
# Fix ANSI color in Windows 10 version 10.0.14393 (Windows Anniversary Update)
import ctypes
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
@RDCH106
RDCH106 / codacy-python-default-conf.json
Created November 16, 2016 14:22
Default review criteria for a Python project in Codacy
{
"patterns" : [{
"patternId" : "Custom_Scala_NonFatal",
"enabled" : true
}, {
"patternId" : "CSSLint_shorthand",
"enabled" : true
}, {
"patternId" : "CSSLint_errors",
"enabled" : true
@RDCH106
RDCH106 / .codacy-pylintrc
Created November 16, 2016 14:41
PyLint configuration using defaults PyLint values from Codacy
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not
@RDCH106
RDCH106 / Factory_pattern.cpp
Last active March 14, 2017 15:24
In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method.
#include <iostream>
#include <memory>
#include <string>
struct Base
{
virtual ~Base() = default;
};
struct Derived : public Base
@RDCH106
RDCH106 / rename.sh
Last active March 29, 2017 15:21 — forked from iBet7o/description.md
Script bash para renombrar directorios y archivos
#! /bin/bash
source flash.sh
# Variables
# ------------------------------------------------------------------------------
pathLog=`echo $(pwd)/log.txt`
echo -n "Path to rename: "
@RDCH106
RDCH106 / flash.sh
Last active March 29, 2017 15:20 — forked from iBet7o/description.md
Color del texto en scripts bash
#! /bin/bash
# Variables
# ------------------------------------------------------------------------------
txtSuccess='\033[1;32m'
txtError='\033[0;31m'
txtNoColor='\033[0m'
@RDCH106
RDCH106 / DI.m3u
Last active March 10, 2020 05:40 — forked from sim642/DI.m3u
Digitally Imported premium streams
#EXTM3U
#EXTINF:-1,Digitally Imported - Ambient
http://pub1.diforfree.org:8000/di_ambient_hi
#EXTINF:-1,Digitally Imported - Big Room House
http://pub1.diforfree.org:8000/di_bigroomhouse_hi
#EXTINF:-1,Digitally Imported - Breaks
http://pub1.diforfree.org:8000/di_breaks_hi
@RDCH106
RDCH106 / cpp_logger.h
Created January 23, 2018 15:22
C++ logger with logging levels (standard output)
#pragma once
#if defined(___LOG_DEBUG)
# include <iostream>
# define LOGD(...) std::cout << " " << __VA_ARGS__ << "\t - " << LOG_TAG << std::endl;
# define LOGI(...) std::cout << " " << __VA_ARGS__ << "\t - " << LOG_TAG << std::endl;
# define LOGW(...) std::cout << " * Warning: " << __VA_ARGS__ << "\t - " << LOG_TAG << std::endl;
# define LOGE(...) std::cout << " *** Error: " << __VA_ARGS__ << "\t - " << LOG_TAG << std::endl;
#elif defined(___LOG_INFO)
@RDCH106
RDCH106 / file_content_replacer.py
Last active February 3, 2022 05:52
Searching and Replacing Text in a File
#!/usr/bin/env python
import os
import sys
nargs = len(sys.argv)
if not nargs == 5:
print("usage: %s search_text replace_text infile outfile" % os.path.basename(sys.argv[0]))
elif sys.argv[3] == sys.argv[4]:
@RDCH106
RDCH106 / .htaccess
Created June 22, 2018 15:50 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/