Skip to content

Instantly share code, notes, and snippets.

View iris9112's full-sized avatar
😸

Isabel Ruiz Buriticá iris9112

😸
View GitHub Profile
@iris9112
iris9112 / create_folders.py
Created December 28, 2022 03:07
Three examples of creating nested folders
def method_one():
"""
Method-1: Using pathlib.Path.mkdir()
mkdir(mode=0o777, parents=False, exist_ok=False)
These parameters are optional.
If mode is given, it determines the file mode and access flags.
However, if the path already exists, then it will raise a FileExistsError exception.
# Minimal example of POO
class Person(object):
has_animal = False
pets = list()
def __init__(self, name, last_name):
self.name = name
self.last_name = last_name
@iris9112
iris9112 / command_summary.md
Last active January 18, 2020 04:13
Summary of useful commands, which I always forget

GIT

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "OUR_NAME@example.com"

UBUNTU

import requests
from requests.exceptions import HTTPError
isa = 'https://api.github.com/users/iris9112/gists'
santi = 'https://api.github.com/users/rmotr-doesnt-exist/gists'
for url in [isa, santi]:
try:
response = requests.get(url)
# If the response was successful, no Exception will be raised
@iris9112
iris9112 / SLCSP_iris9112.py
Created July 10, 2019 21:45
Calculate second lowest cost silver plan (SLCSP)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Calculate second lowest cost silver plan (SLCSP)
https://homework.adhoc.team/slcsp/
The instruction for run program is:
python SLCSP_iris9112.py -s files/slcsp.csv -p files/plans.csv -z files/zips.csv
"""
"""
delete all compiled binaries files
"""
import os
import argparse
def delete_binaries(folder_path=None):
"""
delete binaries given a folder, if not given,
"""
delete all migration files, run it at the top of project folder
run with the virtualenvwrapper virtualenv activated
TODO: find migration if located on os python folder
"""
import os
import argparse
def delete_migrations(folder_path=None):
@iris9112
iris9112 / pypdf_to_image.py
Created June 21, 2018 14:48 — forked from rririanto/pypdf_to_image.py
Python Convert PDF to Image
"""
Problem:
How to Convert PDF to Image with Python Script ?
Installation:
I use ubuntu OS 14.04
We use wrapper for ImageMagick [http://www.imagemagick.org/script/index.php] to Convert The PDF file
in Python do:
$ sudo apt-get install libmagickwand-dev