Skip to content

Instantly share code, notes, and snippets.

Avatar
Partially offline. No time...

Rubén de Celis Hernández RDCH106

Partially offline. No time...
View GitHub Profile
View Microsoft_VCPKG_CLA.md

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”), and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your contributions to Microsoft open source projects. This Agreement is effective as of the latest signature date below.

  1. Definitions. “Code” means the computer software code, whether in human-readable or machine-executable form, that is delivered by You to Microsoft under this Agreement. “Project” means any of the projects owned or managed by Microsoft and offered under a license approved by the Open Source Initiative (www.opensource.org). “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any Project, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of discussing
@RDCH106
RDCH106 / python3_requiere_named_arguments.py
Created Jul 2, 2021
Requiring your arguments be named in a function calling
View python3_requiere_named_arguments.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def classic_function(x, y ,z):
print(x, y, z)
def force_named_arguments_function(*, x, y ,z):
print(x, y, z)
@RDCH106
RDCH106 / get-pip.py
Created Jan 26, 2021
Python - PIP package manager installation (bootstrapping)
View get-pip.py
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base85 encoding of a zip file, this zip file contains
# an entire copy of pip (version 20.2.4).
#
# Pip is a thing that installs packages, pip itself is a package that someone
@RDCH106
RDCH106 / is_admin.py
Last active Feb 10, 2021
Cross-platform script to check admin rights in Python
View is_admin.py
import ctypes, os
from sys import exit
def is_admin():
is_admin = False
is_win = False
try:
is_admin = os.getuid() == 0
except AttributeError:
View userDefinedLang-markdown.default.modern.xml
<NotepadPlus>
<UserLang name="Markdown (Default)" ext="md markdown" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="2" decimalSeparator="0" />
<Prefix Keywords1="yes" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="yes" Keywords7="yes" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02((EOL)) 03&lt;!-- 04--&gt;</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@RDCH106
RDCH106 / class_prototype.py
Created Dec 3, 2019
Python Class Prototype (Example) - Scope: Private, Public, Internal, Static
View class_prototype.py
# -*- coding: utf-8 -*-
from random import randint
class MyClass(object):
# Static class variable
static_variable = 17
@RDCH106
RDCH106 / wmi_logicaldisk_free_space.py
Created Nov 19, 2019
Show free space for all logical disks
View wmi_logicaldisk_free_space.py
#!/usr/bin/env python
try:
import wmi
except ImportError as e:
print(e)
print("Please, install wmi package using 'pip install wmi'")
exit(-1)
c = wmi.WMI ()
@RDCH106
RDCH106 / explicit_method.cpp
Created Apr 15, 2019
Explicit directive simulation for method arguments and avoid implicit conversion
View explicit_method.cpp
#include <iostream>
#include <string>
#include <vector>
#include <type_traits>
struct A
{
operator const char*() {
return m_str.c_str();
}
@RDCH106
RDCH106 / md2rst.py
Created Apr 15, 2019
Script to convert Markdown (.md) to ReStructuredText (.rst)
View md2rst.py
# -*- coding: utf-8 -*-
try:
import pypandoc
except ImportError:
print("pypandoc not available!!")
exit("First install pypandoc. Ex: \"pip install pypandoc\"")
long_description = pypandoc.convert('README.md', 'rst', outputfile='README.md2rst')
@RDCH106
RDCH106 / cpp_inheritance_with_functions_with_default_parameter_example.cpp
Created Mar 21, 2019
C++ Inheritance with functions with default parameter example
View cpp_inheritance_with_functions_with_default_parameter_example.cpp
#include <iostream>
#include <string>
#include <vector>
struct A
{
void f_sinarg() {
f(3);
}