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 | |
# iterates over all the .jpg files in a directory | |
# * creates a 1080p version with a 50% transparent signature (if not already present) | |
# * creates a 2160p version with a 8% transparent signature (if not already present) | |
FILE_sign_1080=signature_1080.png | |
FILE_sign_2160=signature_2160.png | |
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 | |
# show all the relevant hardware information from network interfaces | |
for DEV in /sys/class/net/* ; do | |
dev_name=$(basename "${DEV}") | |
echo "# $dev_name =========================================" | |
hardware_path=$(udevadm info --query=path --path=${DEV} 2>&1) | |
if [ -z "$hardware_path" ]; then | |
echo "Could not find the hardware path, skipping." |
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
# encoding: utf-8 | |
import json | |
import pprint | |
import codecs | |
import iso8601 | |
import datetime | |
# this is the json from https://elezioni.tracking.exposed/campaign/opendata/ | |
filename = 'archive.json' |
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, this repo is having problems with yum | |
base_url="https://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-7/noarch/" | |
file_tmp=$(mktemp) | |
/usr/bin/curl -sS -Lo "$file_tmp" "$base_url" | |
if [ "x$?" != "x0" ]; 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
# based on https://gist.github.com/twtw/5494223 | |
# create systemd service file for rails/puma startup | |
# 0. [if required: rvm use ruby@default] | |
# 1. rvm wrapper default systemd rails | |
# 2. put this file in /etc/systemd/system/rails-puma.service | |
# 3. systemctl enable rails-puma | |
# 4. systemctl start rails-puma | |
[Unit] | |
Description=Rails-Puma Webserver | |
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
# Please read the corosync.conf.5 manual page | |
compatibility: whitetank | |
totem { | |
# cluster name | |
cluster_name: coro01 | |
# totem parameters | |
version: 2 | |
secauth: off |
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 | |
# outputs a visual hash for the system is running on: | |
# useful to identify which system you are running your commands on | |
# first two bytes for the unicode sequence, by default we use 28 | |
# since the braille character set is fully compliant and easy to identify | |
# the characters will be: u+${BASE_UNICODE}${first_hex}${second_hex} | |
# good values are: 14, 22, 25, 28, 2F, 34, A5, FB, 106, 131 | |
BASE_UNICODE=14 |
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
import os | |
import hashlib | |
# calc directory checksum | |
def calc_dir_sum(path): | |
for root, dirs, files in os.walk(path): | |
dir_hash = hashlib.md5() | |
# calc checksum for each file | |
# based on file name, size and mtime |
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 http://www.streamcomputing.eu/blog/2011-06-24/install-opencl-on-debianubuntu-orderly/ | |
DIR=/usr/include/ | |
for VERSION in 1.1 1.2; do | |
echo "Downloading headers for version ${VERSION}..." | |
mkdir -p "${DIR}/CL-${VERSION}" |
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
# encoding: utf-8 | |
# using XPath 1.0, ref: http://www.exampledepot.com/egs/org.w3c.dom/xpath_GetElemByText.html | |
class XPathFactory | |
# build a XPath to find any link with content "content" inside a | |
# container with class "class_name" | |
def by_container_class_and_link_content(class_name, content) | |
"//*[@class and contains(concat(' ',normalize-space(@class),' ')," + | |
"' #{class_name} ')]//a[contains(translate(.,'abcdefghijklmnopqrstuvwxyz'," + |
NewerOlder