Rubén de Celis Hernández RDCH106
-
STT Systems
- Vitoria, Basque Country, Spain
- Sign in to view email
- http://rdch106.hol.es/
View class_prototype.py
# -*- coding: utf-8 -*- | |
from random import randint | |
class MyClass(object): | |
# Static class variable | |
static_variable = 17 |
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 () |
View explicit_method.cpp
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <type_traits> | |
struct A | |
{ | |
operator const char*() { | |
return m_str.c_str(); | |
} |
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') |
View cpp_inheritance_with_functions_with_default_parameter_example.cpp
#include <iostream> | |
#include <string> | |
#include <vector> | |
struct A | |
{ | |
void f_sinarg() { | |
f(3); | |
} |
View python_switch_examples.py
############################# | |
# Example with values | |
############################# | |
def switch_value(x): | |
return{ | |
0: "APPLE", | |
1: "ORANGE", | |
2: "BANANA", | |
3: "PEACH" |
View cpp_callback_example.cpp
#include <iostream> | |
#include <string> | |
#include <vector> | |
// Dll | |
typedef bool (*PointerToF)(int number); | |
struct A { | |
PointerToF m_f; |
View Python TCP Client Example.py
import socket | |
hostname, sld, tld, port = 'www', 'integralist', 'co.uk', 80 | |
target = '{}.{}.{}'.format(hostname, sld, tld) | |
# create an ipv4 (AF_INET) socket object using the tcp protocol (SOCK_STREAM) | |
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# connect the client | |
# client.connect((target, port)) |
View .htaccess
#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/ |
View file_content_replacer.py
#!/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]: |
NewerOlder