Skip to content

Instantly share code, notes, and snippets.

View RafaAguilar's full-sized avatar

Rafael Aguilar RafaAguilar

View GitHub Profile
@RafaAguilar
RafaAguilar / Terrascan Ignore Policies Workaround
Created November 10, 2020 13:25
Using a .terraignore file to mimic Ignoring Policies behavior
# How to ignore specific terrascan meanwhile gets implemented
## Let's suppose we want to ignore policies XXX and YYY, we could create a file with that information:
accurics.azure.NS.XXX
accurics.azure.NS.YYY
## Later we could add make a dirty and short but yet practical bash snippet to mimic the "ignore" behavior:
PATH_TO_TERRAIGNORE=./.terraignore
@RafaAguilar
RafaAguilar / conceptual_test.py
Last active January 28, 2017 17:33 — forked from ezequielrozen/conceptual_test.py
Revisión - Respuesta
from db_model.models.content import RawArticle
from db_model.models.source import Source
from engine.celery import app, BaseTask
from engine.resources.vimeo_service import fetch_user_videos
from engine.resources.youtube_service import get_youtube_uploads
from time import strptime
from engine.utils.lock import FetchLock
import requests
'''Imports:
Mi primera observación sería ordenar los imports, conservando el orden
@RafaAguilar
RafaAguilar / virtualenv-auto-activate.sh
Last active December 5, 2016 14:15 — forked from codysoyland/virtualenv-auto-activate.sh
virtualenv-auto-activate
#!/bin/bash
# Based on virtualenv-auto-activate.sh
# Source: https://gist.github.com/codysoyland/2198913
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# As a difference with the original, this script will look
@RafaAguilar
RafaAguilar / convert_complex_unicode_dict.md
Created April 12, 2016 13:51
Python: Convert a complex dict with possible UTF values into a regular STR one
def array_to_utf(a):
    autf = []
    i = 0
    for v in a:
        if isinstance(v, unicode):
            autf.append(v.encode('utf-8'))
        elif isinstance(v, dict):
            autf.append(dict_to_utf(v))
 elif isinstance(v, list):
@RafaAguilar
RafaAguilar / get_not_null_and_no_default_fields.sql
Created January 31, 2016 03:57
Obtain _not null_ and with no _default value_ fields of a table (useful when you need an _INSERT_ test statement of a big table)
SELECT
COLUMN_NAME AS `Field`
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = 'schemaName'
AND TABLE_NAME = 'tableName'
AND IS_NULLABLE = 'NO'
AND (COLUMN_DEFAULT IS NULL
OR COLUMN_DEFAULT = '')
@RafaAguilar
RafaAguilar / order_OrderedDict.py
Last active January 30, 2016 01:32
Order an OrderedDict with numeric String keys
def str_num_order_odict(odict):
return OrderedDict(sorted(odict.items(), key=lambda x: int(x[0])))
@RafaAguilar
RafaAguilar / flaskwithcron.py
Last active November 18, 2015 03:18 — forked from chadselph/flaskwithcron.py
flask with "cron"-like loop
from flask import Flask, render_template, jsonify, request
from threading import Timer, Thread
from time import sleep
app = Flask(__name__)
@app.route("/api/<method>")
def api(method):
data = {

#Codec for play mp4a not found - VLC

To workaorund this you should enable the repos Tainted Release, Tainted Updates (in my case, also Tainted Backports):

Then update the whole system, now you VLC should play properly (with audio) mp4 videos.

#RVM & Rails 4 on Mageia 5

This guide try to be a guidetrough to install rvm & rails 4 as a single user on Mageia 5

  • Enable sudo: Follow, estrictly, this guide

  • Install Pre-requisites

Run as root(or sudo):

def dump_sitemap(site_name,products):
frmt = 'csv'
logger.debug("Monkey #" + str(os.getpid()) + " Writing Sitemap to " + site_name + "." + frmt)
if frmt == 'json':
site_map_file = open(site_name + ".json","w")
site_map_file.write(json.dumps(products['urlset']))
elif frmt == 'csv':
site_map_file = open(site_name + ".csv","w")
products = products['urlset']['url']
for p_index in range(1,len(products)):