Skip to content

Instantly share code, notes, and snippets.

View Hispar's full-sized avatar

Pablo Burgos Hispar

  • Madrid
View GitHub Profile
@Hispar
Hispar / gist:3b919d289cb495d7e570ddce37584eb7
Last active February 28, 2020 08:43
Google Cloud Storage python
# -*- coding: utf-8 -*-
# Python imports
import glob
import os
# 3rd Party imports
from django.conf import settings
from google.cloud import storage
@Hispar
Hispar / gist:84d0eb38e9a86ed207fd54ee51e03e0d
Created August 5, 2019 16:34
Find DOW keys in windows registry
from winreg import HKEY_CURRENT_USER, ConnectRegistry, OpenKey, EnumKey, QueryValueEx
aReg = ConnectRegistry(None, HKEY_CURRENT_USER)
aKey = OpenKey(aReg, "Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\THQ")
f = open("dow_keys.txt", "a")
for i in range(1024):
try:
keyname = EnumKey(aKey, i)
@Hispar
Hispar / Dockerfile
Created July 30, 2019 10:51
Dockerfile for python3 with sqlserver connection
FROM ubuntu:18.04
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get install -y curl gnupg2 software-properties-common
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
#Ubuntu 18.04
RUN curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
@Hispar
Hispar / type.py
Created October 9, 2018 08:28
Working with django money and django graphene
import graphene
from graphene_django import DjangoObjectType
class Money(graphene.Scalar):
@staticmethod
def serialize(value):
return value
@staticmethod
def parse_literal(node):
@Hispar
Hispar / DOCKER-README.md
Last active February 22, 2017 16:10
Guía de uso básico para proyectos python con docker en Ubuntu 16
@Hispar
Hispar / url_replace.py
Created August 26, 2015 07:30
Replace domains in specified order in the given file.
# python 3 imports
from __future__ import print_function
# imports
import fileinput
import re
# vars
domains_order = [
'www.domain1.com',
@Hispar
Hispar / extract_domains.py
Last active August 29, 2015 14:28
Script to retrieve domains from a text. Based on http://stackoverflow.com/questions/21211572/extract-all-domains-from-text but with different regexp.
# python 3 imports
from __future__ import unicode_literals, print_function
# imports
import re
# vars
text = " A long text with url like www.google.com and www.twitter.com and lorem ipsum dolor sit amet www.tabga.es"
regex = r'([a-z0-9][-a-z0-9]*[a-z0-9]|[a-z0-9])\.(([a-z]{2,4}|[a-z]{2,3}.uk))(?![-0-9a-z])(?!\.[a-z0-9])'