This file contains hidden or 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 hidden or 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 hidden or 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) |
This file contains hidden or 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
#encoding: utf-8 | |
import sys | |
import time | |
import PIL.Image | |
def marshal_image(image): | |
data = image.convert('1') | |
w, h = data.size | |
out = bytearray() |
This file contains hidden or 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
import sys | |
import nltk | |
import nltk.tokenize.regexp | |
import nltk.stem.snowball | |
import nltk.corpus | |
import requests | |
import lxml.html | |
lang = 'spanish' | |
def get_text(): |
This file contains hidden or 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
<html> | |
<head> | |
<title>Open PDF</title> | |
</head> | |
<body> | |
javascript:location.href=document.querySelector('object[type="application/pdf"]').getAttribute('data') | |
</body> | |
</html> |
This file contains hidden or 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 is a modified version of node's built-in tls.js patched not to check | |
// the server hostname against its certificate. | |
// | |
// node 0.10 does not support this in a clean way. | |
// This will be allowed in node 0.12 setting a checkServerIdentity function | |
// in the HTTPS agent config. | |
function checkServerIdentity(host, cert) { | |
return true; | |
} |
This file contains hidden or 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 hidden or 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 | |
import dbus | |
session_bus = dbus.SessionBus() | |
players = [x for x in session_bus.list_names() | |
if x.startswith('org.mpris.MediaPlayer2')] | |
if len(players) < 0: | |
print("No players found! :(", file=sys.stderr) | |
sys.exit(1) |
This file contains hidden or 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/python3 | |
# TODO: Does not support woff2 fonts (as served for Chrome) | |
import os, sys, re | |
import requests | |
def fetch_fonts(input_css, font_path="fonts"): | |
output_css = [] | |
for line in input_css.split("\n"): | |
if "https://" in line: | |
name = re.match(r".*local\('(.*?)'\).*", line).groups()[0] |