Skip to content

Instantly share code, notes, and snippets.

View gfhuertac's full-sized avatar

Gonzalo Huerta-Canepa gfhuertac

  • Microsoft
  • Viña del Mar, Chile
  • X @gohucan
View GitHub Profile
# Listing 1 - Get-SystemInfo.ps1
Get-CimInstance -Class Win32_OperatingSystem |
Select-Object Caption, InstallDate, ServicePackMajorVersion,
OSArchitecture, BootDevice, BuildNumber, CSName,
@{l='Total_Memory';e={[math]::Round($_.TotalVisibleMemorySize/1MB)}}
@gfhuertac
gfhuertac / ways.py
Last active July 6, 2020 12:37
Combination of coins to achieve a total
"""
From: https://breadth.substack.com/p/what-the-hell-is-a-deno
In Australia, we have the following coins:
5¢ 10¢ 20¢ 50¢ $1 and $2 coins.
One way of making up $3 is by:
$1 + 50¢ + 50¢ + 50¢ + 20¢ + 20¢ + 10¢
# python modules
import sqlite3
from collections import namedtuple
# 3rd party modules
from bs4 import BeautifulSoup
# named tuple... we do not need a class for this
Product = namedtuple('Product', ['product_id', 'category', 'name', 'price', 'discount'])
# python modules
from enum import Enum
from time import sleep
# 3rd party modules
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
<nav>
<ul class="pagination">
<li class="done">
<a href="#">&nbsp;</a>
</li>
<li><span>2</span></li>
<li><span>3</span></li>
</ul>
</nav>
var ffi = require('ffi');
var ref = require('ref');
var struct = require('ref-struct');
var winapi = {};
winapi.bool = ref.types.bool;
winapi.int = ref.types.int;
winapi.ulong = ref.types.ulong;
winapi.void = ref.types.void;
winapi.PVOID = ref.refType(winapi.void);
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 14 columns, instead of 6 in line 8.
order_id,customer_id,employee_id,order_date,required_date,shipped_date,ship_via,freight,ship_name,ship_address,ship_city,ship_region,ship_postal_code,ship_country
10248,VINET,5,1996-07-04,1996-08-01,1996-07-16,3,32.38,Vins et alcools Chevalier,59 rue de l'Abbaye,Reims,,51100,France
10249,TOMSP,6,1996-07-05,1996-08-16,1996-07-10,1,11.61,Toms Spezialitäten,Luisenstr. 48,Münster,,44087,Germany
10250,HANAR,4,1996-07-08,1996-08-05,1996-07-12,2,65.83,Hanari Carnes,"Rua do Paço, 67",Rio de Janeiro,RJ,05454-876,Brazil
10251,VICTE,3,1996-07-08,1996-08-05,1996-07-15,1,41.34,Victuailles en stock,"2, rue du Commerce",Lyon,,69004,France
10252,SUPRD,4,1996-07-09,1996-08-06,1996-07-11,2,51.3,Suprêmes délices,"Boulevard Tirou, 255",Charleroi,,B-6000,Belgium
10253,HANAR,3,1996-07-10,1996-07-24,1996-07-16,2,58.17,Hanari Carnes,"Rua do Paço, 67",Rio de Janeiro,RJ,05454-876,Brazil
10254,CHOPS,5,1996-07-11,1996-08-08,1996-07-23,2,22.98,Chop-suey Chinese,Hauptstr. 31,Bern,,3012,Switzerland
10255,RICSU,9,1996-07-12,1996-08-09,1996-
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
employee_id,last_name,first_name,title,title_of_courtesy,birth_date,hire_date,address,city,region,postal_code,country,home_phone,extension,photo,notes,reports_to,photo_path
1,Davolio,Nancy,Sales Representative,Ms.,1948-12-08,1992-05-01,507 - 20th Ave. E.\nApt. 2A,Seattle,WA,98122,USA,(206) 555-9857,5467,\x,Education includes a BA in psychology from Colorado State University in 1970. She also completed The Art of the Cold Call. Nancy is a member of Toastmasters International.,2,http://accweb/emmployees/davolio.bmp
2,Fuller,Andrew,"Vice President, Sales",Dr.,1952-02-19,1992-08-14,908 W. Capital Way,Tacoma,WA,98401,USA,(206) 555-9482,3457,\x,"Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, t
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 11 columns, instead of 3 in line 8.
customer_id,company_name,contact_name,contact_title,address,city,region,postal_code,country,phone,fax
ALFKI,Alfreds Futterkiste,Maria Anders,Sales Representative,Obere Str. 57,Berlin,,12209,Germany,030-0074321,030-0076545
ANATR,Ana Trujillo Emparedados y helados,Ana Trujillo,Owner,Avda. de la Constitución 2222,México D.F.,,05021,Mexico,(5) 555-4729,(5) 555-3745
ANTON,Antonio Moreno Taquería,Antonio Moreno,Owner,Mataderos 2312,México D.F.,,05023,Mexico,(5) 555-3932,
AROUT,Around the Horn,Thomas Hardy,Sales Representative,120 Hanover Sq.,London,,WA1 1DP,UK,(171) 555-7788,(171) 555-6750
BERGS,Berglunds snabbköp,Christina Berglund,Order Administrator,Berguvsvägen 8,Luleå,,S-958 22,Sweden,0921-12 34 65,0921-12 34 67
BLAUS,Blauer See Delikatessen,Hanna Moos,Sales Representative,Forsterstr. 57,Mannheim,,68306,Germany,0621-08460,0621-08924
BLONP,Blondesddsl père et fils,Frédérique Citeaux,Marketing Manager,"24, place Kléber",Strasbourg,,67000,France,88.60.15.31,88.60.15.32
BOLID,Bólido Comidas preparadas,Martín Som
# -*- coding: utf-8 -*-
# paso 0. Importar módulos
import requests
import matplotlib.pyplot as plt
import numpy as np
# ejercicio 1. Convertir las instrucciones a una función llamada muestra_imagen
def guarda_imagen(imagen, indice):
plt.imsave('imagen_' + str(indice) + '.png', imagen)