Skip to content

Instantly share code, notes, and snippets.

View mondeja's full-sized avatar

Álvaro Mondéjar Rubio mondeja

View GitHub Profile
@mondeja
mondeja / po2txt.sh
Created September 23, 2022 22:22
po2txt
#!/bin/sh
output=""
inside_msgstr=0
newline=""
add_newline_to_output() {
if [ -z "$output" ]; then
output="${newline}\n"
else
@mondeja
mondeja / txt2po.sh
Last active September 23, 2022 21:46
txt2po
#!/bin/sh
output=""
while read line; do
if [ -z "$line" ]; then
continue
fi;
escaped_line=$(echo $line | sed -e 's/"/\\"/g')
new_line="msgid \"$escaped_line\"\nmsgstr \"\""
@mondeja
mondeja / make.bat
Last active October 13, 2018 20:12
`make` command wrapper for Windows
:: Uses as Make GNU, for example `make start`
:: will executes :start function.
:: Keep in mind that this implementation
:: has some limitations. For example, you can't
:: call more than one command from another command
:: if the called command has an `goto :end` line,
:: because the script will terminate on first
:: `goto <command>` invocation.
:: Do not display commands
@mondeja
mondeja / examples.py
Last active November 30, 2020 06:54
Python-to-Markdown magics line table generator
# DataFrame example
df = pd.DataFrame(data={'col1': ["one", 2], 'col2': [3, "four"]})
df = df.to_dict() # You need to pass as dict
%md table $df # <---- In Jupyter Notebook cell
#------------------------------------------------------------
# Dict structure example
@mondeja
mondeja / re_vs_json_decoder.py
Last active February 3, 2018 23:09
Comparation parsing broken JSON text with json decoder and re modules.
from re import sub
from timeit import timeit
from json import loads
from requests import get
def test(res):
return type(res) == list and \
type(res[0]) == dict and \
type(res[0]["last_updated"]) == int
@mondeja
mondeja / gulpfile.babel.js
Last active May 25, 2021 02:21
Gulp tasks to watch and transpile ES6 to ES5
"use strict";
import gulp from "gulp";
import uglify from "gulp-uglify";
import babel from "gulp-babel";
const dirs = {
src: "src/*.js",
dest: "build"
}
@mondeja
mondeja / articles.html
Created November 12, 2017 19:58 — forked from cjgiridhar/articles.html
Tornado - Static File Handler
<html>
<title>
Articles
</title>
<body>
<h1>Articles page</h1>
<p><img src="images/images.jpg"/></p>
</body>
</html>
@mondeja
mondeja / .gitignore
Created October 28, 2017 09:34 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@mondeja
mondeja / select_env.sh
Last active October 28, 2017 12:54
Selecciona un entorno virtual
#!/bin/bash
echo && echo "Selecciona el entorno virtual que quieres usar"
echo "1. Python (pyenv)"
echo "2. NodeJS (jsenv)"
echo "3. Ruby (rbenv)"
read -n 1 c
if [ $c == 1 ]; then
source pyenv/bin/activate
@mondeja
mondeja / full-ffmpeg.sh
Created April 22, 2017 17:21
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src