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
#!/usr/bin/env python | |
# Usage: python patch-qtcreator-project.py CMakeLists.txt.user -DPORT=GTK -DENABLE_MEDIA_SOURCE=ON ... | |
from argparse import ArgumentParser | |
from xml.etree import ElementTree | |
def clean_cmake_args(cmake_args): | |
""" | |
Not all arguments are relevant for QtCreator. | |
Returns a list with only the relevant ones. |
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
/* | |
* This program scans images in order to find white borders having no | |
* substantial content inside. This can be used to automatically crop | |
* meaningless parts of images. | |
* | |
* This program is designed to work only with white backgrounds. | |
* | |
* A Qt based test utility is provided in the main() function. | |
* | |
* Copyright (c) 2016 Juan Luis Boya |
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 | |
# For some reason, volume control lags in Spotify, but not when pavucontrol is | |
# executing. | |
# | |
# Other volume control apps, like gnome-control-center are not enough, it has | |
# to be pavucontrol. | |
# | |
# This is unfortunate, among other reasons, because pavucontrol uses quite a | |
# few CPU resources while opened. |
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
var fibrous = require('fibrous'); | |
var fs = require('fs'); | |
var wait = function wait(ms, callback) { | |
setTimeout(callback, ms); | |
}; | |
function getSomething() { | |
var a = fs.sync.readFile('/tmp/a', 'utf8'); | |
var b = fs.sync.readFile('/tmp/b', 'utf8'); |
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 | |
if [ ! $# -eq 2 ]; then | |
echo "Este es un script para comprimir fotos." | |
echo "Uso: $1 <carpeta con fotos originales> <carpeta de destino para las fotos comprimidas>" | |
fi | |
if ! which convert > /dev/null 2>&1; then | |
echo "No tienes imagemagick... Procedo a instalarlo." | |
sudo bash -c 'apt-get update && apt-get -y install imagemagick' | |
fi |
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
# http://stackoverflow.com/a/22614738/1777162 | |
SCRIPT=$( readlink -m $( type -p "$0" )) # Full path to script | |
BASE_DIR=`dirname "${SCRIPT}"` # Directory script is run in | |
NAME=`basename "${SCRIPT}"` # Actual name of script even if linked |
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
#define _BSD_SOURCE | |
#define _POSIX_C_SOURCE 200809L | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <dirent.h> | |
#include <endian.h> | |
#include <stdint.h> | |
#include <sys/stat.h> |
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 | |
min_ratio=$(bc -l <<< 4/3) | |
max_ratio=$(bc -l <<< 20/9) | |
min_height=720 | |
images=() | |
for f in *.png *.jpg; do | |
read ratio height <<<$(identify -format '%[fx:w/h] %[fx:h]' "$f") | |
if (( $(bc <<< "$ratio >= $min_ratio && $ratio <= $max_ratio \ | |
&& $height >= $min_height") == 1)); then |
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 | |
set -eu | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 domain.example.com" | |
echo | |
echo "Generates a private key and a default CSR which you can send to" \ | |
"your CA. It prompts later for the certificate and stores it in a" \ | |
"reasonable place." | |
echo "Tested only with StartSSL." | |
exit 1 |
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
#!/usr/bin/python | |
import sys | |
from PIL import Image, ImageDraw, ImageColor | |
from argparse import ArgumentParser | |
cell_w = cell_h = 40 | |
def color_to_hex(color): | |
return '#' + ''.join('%02x' % x for x in color) |