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):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def str_num_order_odict(odict): | |
return OrderedDict(sorted(odict.items(), key=lambda x: int(x[0]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)): |
NewerOlder